mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-19 07:46:24 -05:00
Compare commits
No commits in common. "1cdc889f6ff2fa8a6a895a86df10a5742ddf07c9" and "4b45ca231ee8ce86fbd93e6ba73d9fd6bf4e0076" have entirely different histories.
1cdc889f6f
...
4b45ca231e
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,4 +1,2 @@
|
|||||||
depend.mak
|
em
|
||||||
ue
|
|
||||||
*.o
|
*.o
|
||||||
*.exe
|
|
||||||
|
42
Makefile
42
Makefile
@ -1,5 +1,5 @@
|
|||||||
# Makefile -- µEMACS
|
# Makefile -- uEMACS
|
||||||
# Copyright © 2013-2021 Renaud Fivet
|
# Copyright (c) 2014-2021 Renaud Fivet
|
||||||
|
|
||||||
# Make the build silent by default
|
# Make the build silent by default
|
||||||
V =
|
V =
|
||||||
@ -25,7 +25,7 @@ WARNINGS=-pedantic -Wall -Wextra -Wstrict-prototypes -Wno-unused-parameter
|
|||||||
CFLAGS=-O2 $(WARNINGS)
|
CFLAGS=-O2 $(WARNINGS)
|
||||||
LDFLAGS=-s
|
LDFLAGS=-s
|
||||||
LIBS=-lcurses
|
LIBS=-lcurses
|
||||||
DEFINES=-DAUTOCONF -DPROGRAM=$(PROGRAM) # -DNDEBUG
|
DEFINES=-DAUTOCONF -DPROGRAM=$(PROGRAM)
|
||||||
ifeq ($(uname_S),Linux)
|
ifeq ($(uname_S),Linux)
|
||||||
DEFINES += -DPOSIX -DUSG
|
DEFINES += -DPOSIX -DUSG
|
||||||
else ifeq ($(uname_S),CYGWIN)
|
else ifeq ($(uname_S),CYGWIN)
|
||||||
@ -38,6 +38,18 @@ else
|
|||||||
$(error $(uname_S) needs configuration)
|
$(error $(uname_S) needs configuration)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
#ifeq ($(uname_S),FreeBSD)
|
||||||
|
# DEFINES=-DAUTOCONF -DPOSIX -DSYSV -D_FREEBSD_C_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_XOPEN_SOURCE=600
|
||||||
|
#endif
|
||||||
|
#ifeq ($(uname_S),Darwin)
|
||||||
|
# DEFINES=-DAUTOCONF -DPOSIX -DSYSV -D_DARWIN_C_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_XOPEN_SOURCE=600
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#LIBS=-ltermcap # BSD
|
||||||
|
#LIBS=-lcurses # SYSV
|
||||||
|
#LIBS=-ltermlib
|
||||||
|
#LIBS=-L/usr/lib/termcap -ltermcap
|
||||||
|
LFLAGS=-hbx
|
||||||
BINDIR=/usr/bin
|
BINDIR=/usr/bin
|
||||||
LIBDIR=/usr/lib
|
LIBDIR=/usr/lib
|
||||||
|
|
||||||
@ -48,9 +60,15 @@ $(PROGRAM): $(OBJS)
|
|||||||
$(E) " LINK " $@
|
$(E) " LINK " $@
|
||||||
$(Q) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
$(Q) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
||||||
|
|
||||||
|
SPARSE=sparse
|
||||||
|
SPARSE_FLAGS=-D__LITTLE_ENDIAN__ -D__x86_64__ -D__linux__ -D__unix__
|
||||||
|
|
||||||
|
sparse:
|
||||||
|
$(SPARSE) $(SPARSE_FLAGS) $(DEFINES) $(SRCS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(E) " CLEAN"
|
$(E) " CLEAN"
|
||||||
$(Q) rm -f $(PROGRAM) depend.mak *.o
|
$(Q) rm -f $(PROGRAM) core lintout makeout tags *.o
|
||||||
|
|
||||||
install: $(PROGRAM)
|
install: $(PROGRAM)
|
||||||
strip $(PROGRAM)
|
strip $(PROGRAM)
|
||||||
@ -60,6 +78,22 @@ install: $(PROGRAM)
|
|||||||
chmod 755 ${BINDIR}/$(PROGRAM)
|
chmod 755 ${BINDIR}/$(PROGRAM)
|
||||||
chmod 644 ${LIBDIR}/emacs.hlp ${LIBDIR}/.emacsrc
|
chmod 644 ${LIBDIR}/emacs.hlp ${LIBDIR}/.emacsrc
|
||||||
|
|
||||||
|
lint: ${SRC}
|
||||||
|
@rm -f lintout
|
||||||
|
lint ${LFLAGS} ${SRC} >lintout
|
||||||
|
cat lintout
|
||||||
|
|
||||||
|
splint:
|
||||||
|
splint -weak $(DEFINES) $(SRCS) -booltype boolean -booltrue TRUE -boolfalse FALSE +posixlib +matchanyintegral
|
||||||
|
|
||||||
|
errs:
|
||||||
|
@rm -f makeout
|
||||||
|
make $(PROGRAM) >makeout 2>&1
|
||||||
|
|
||||||
|
tags: ${SRC}
|
||||||
|
@rm -f tags
|
||||||
|
ctags ${SRC}
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(E) " CC " $@
|
$(E) " CC " $@
|
||||||
$(Q) ${CC} ${CFLAGS} ${DEFINES} -c $*.c
|
$(Q) ${CC} ${CFLAGS} ${DEFINES} -c $*.c
|
||||||
|
18
bind.c
18
bind.c
@ -448,19 +448,22 @@ static const char *getfname( unsigned keycode, const char *failmsg) {
|
|||||||
* String key name TO Command Key
|
* String key name TO Command Key
|
||||||
*
|
*
|
||||||
* char *keyname; name of key to translate to Command key form
|
* char *keyname; name of key to translate to Command key form
|
||||||
* fmt: [M-|^X][^][FN]X
|
* fmt: [M-][^X][^][FN]X
|
||||||
* returns ~0 on invalid sequence
|
* returns ~0 on invalid sequence
|
||||||
*/
|
*/
|
||||||
static unsigned int stock( char *keyname) {
|
static unsigned int stock( char *keyname) {
|
||||||
/* parse it up */
|
/* parse it up */
|
||||||
unsigned c = 0 ;
|
unsigned c = 0 ;
|
||||||
|
|
||||||
/* first, the prefix META or ^X */
|
/* first, the META prefix */
|
||||||
if( *keyname == 'M' && keyname[ 1] == '-') {
|
if( *keyname == 'M' && keyname[ 1] == '-') {
|
||||||
c = META ;
|
c = META ;
|
||||||
keyname += 2 ;
|
keyname += 2 ;
|
||||||
} else if( *keyname == '^' && keyname[ 1] == 'X') {
|
}
|
||||||
c = CTLX ;
|
|
||||||
|
/* control-x prefix */
|
||||||
|
if( *keyname == '^' && keyname[ 1] == 'X') {
|
||||||
|
c |= CTLX ;
|
||||||
keyname += 2 ;
|
keyname += 2 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,9 +487,10 @@ static unsigned int stock( char *keyname) {
|
|||||||
if( *keyname < 32 || *keyname == 0x7F) {
|
if( *keyname < 32 || *keyname == 0x7F) {
|
||||||
c |= CTRL ;
|
c |= CTRL ;
|
||||||
*keyname ^= 0x40 ;
|
*keyname ^= 0x40 ;
|
||||||
} else if( c && !(c & SPEC)
|
}
|
||||||
&& *keyname >= 'a' && *keyname <= 'z')
|
|
||||||
/* make sure we are not lower case (not with function keys) */
|
/* make sure we are not lower case (not with function keys) */
|
||||||
|
if( *keyname >= 'a' && *keyname <= 'z' && !(c & SPEC))
|
||||||
*keyname -= 32 ;
|
*keyname -= 32 ;
|
||||||
|
|
||||||
/* the final sequence... */
|
/* the final sequence... */
|
||||||
|
36
input.c
36
input.c
@ -371,10 +371,11 @@ int get1key( void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* GETCMD: Get a command from the keyboard. Process all applicable prefix
|
/* GETCMD: Get a command from the keyboard. Process all applicable prefix
|
||||||
keys. Handle alted and controlled FNx, not shifted.
|
keys. Handle alted and controlled FNx, not shifted. Allow double
|
||||||
|
prefix M-^X.
|
||||||
*/
|
*/
|
||||||
int getcmd( void) {
|
int getcmd( void) {
|
||||||
int prefix = 0 ; /* prefixes M- or ^X */
|
int cmask = 0 ; /* prefixes M- & ^X */
|
||||||
int keyread[ STACKSIZE] ; /* room to process sequences like ^[[24;2~ */
|
int keyread[ STACKSIZE] ; /* room to process sequences like ^[[24;2~ */
|
||||||
int *kptr = keyread ;
|
int *kptr = keyread ;
|
||||||
int c ;
|
int c ;
|
||||||
@ -389,7 +390,7 @@ int getcmd( void) {
|
|||||||
if( c == 'O') { /* F1 .. F4 */
|
if( c == 'O') { /* F1 .. F4 */
|
||||||
c = *(kptr++) = get1key() ;
|
c = *(kptr++) = get1key() ;
|
||||||
if( c >= 'P' && c <= 'S')
|
if( c >= 'P' && c <= 'S')
|
||||||
return c | SPEC | prefix ;
|
return c | SPEC | cmask ;
|
||||||
} else if( c == '[') {
|
} else if( c == '[') {
|
||||||
int v1, v ; /* ^[[v1;v~ or ^[[v~ */
|
int v1, v ; /* ^[[v1;v~ or ^[[v~ */
|
||||||
|
|
||||||
@ -397,17 +398,14 @@ int getcmd( void) {
|
|||||||
v1 = v = 0 ;
|
v1 = v = 0 ;
|
||||||
while( kptr < &keyread[ STACKSIZE]) {
|
while( kptr < &keyread[ STACKSIZE]) {
|
||||||
c = *(kptr++) = get1key() ;
|
c = *(kptr++) = get1key() ;
|
||||||
if( (c == '~')
|
if( (c == '~') || (c >= 'A' && c <= 'Z')) {
|
||||||
|| (c >= 'A' && c <= 'Z')
|
|
||||||
|| (c >= 'a' && c <= 'z')) {
|
|
||||||
/* Found end of sequence */
|
/* Found end of sequence */
|
||||||
int mask = prefix ;
|
|
||||||
if( v1) { /* Handle ALT/CTL, not SHFT */
|
if( v1) { /* Handle ALT/CTL, not SHFT */
|
||||||
if( (v - 1) & 2)
|
|
||||||
mask = META ;
|
|
||||||
|
|
||||||
if( (v - 1) & 4)
|
if( (v - 1) & 4)
|
||||||
mask |= CTRL ;
|
cmask |= CTRL ;
|
||||||
|
|
||||||
|
if( (v - 1) & 2)
|
||||||
|
cmask |= META ;
|
||||||
|
|
||||||
v = v1 ;
|
v = v1 ;
|
||||||
}
|
}
|
||||||
@ -419,7 +417,7 @@ int getcmd( void) {
|
|||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return c | SPEC | mask ;
|
return c | SPEC | cmask ;
|
||||||
} else if( c == ';') { /* Start of SHFT/ALT/CTL state */
|
} else if( c == ';') { /* Start of SHFT/ALT/CTL state */
|
||||||
v1 = v ;
|
v1 = v ;
|
||||||
v = 0 ;
|
v = 0 ;
|
||||||
@ -435,24 +433,20 @@ int getcmd( void) {
|
|||||||
KPUSH( *(--kptr)) ;
|
KPUSH( *(--kptr)) ;
|
||||||
|
|
||||||
c = get1key() ;
|
c = get1key() ;
|
||||||
} else
|
}
|
||||||
kptr-- ;
|
|
||||||
|
|
||||||
if( c == metac) {
|
if( c == metac) {
|
||||||
prefix = META ;
|
cmask |= META ;
|
||||||
} else if( c == ctlxc) {
|
} else if( c == ctlxc) {
|
||||||
if( prefix)
|
cmask |= CTLX ;
|
||||||
break ; /* ^X^X or M-^X */
|
|
||||||
else
|
|
||||||
prefix = CTLX ;
|
|
||||||
} else
|
} else
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( prefix && islower( c))
|
if( cmask && islower( c))
|
||||||
c = flipcase( c) ;
|
c = flipcase( c) ;
|
||||||
|
|
||||||
return c | prefix ;
|
return c | cmask ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A more generalized prompt/reply function allowing the caller
|
/* A more generalized prompt/reply function allowing the caller
|
||||||
|
4
maze.cmd
4
maze.cmd
@ -9,8 +9,6 @@ set %D3 0
|
|||||||
set %D4 -1
|
set %D4 -1
|
||||||
set %D5 0
|
set %D5 0
|
||||||
|
|
||||||
select-buffer maze
|
|
||||||
|
|
||||||
# draw the maze layout
|
# draw the maze layout
|
||||||
$curwidth insert-string " "
|
$curwidth insert-string " "
|
||||||
newline
|
newline
|
||||||
@ -100,5 +98,3 @@ write-message $line
|
|||||||
set $curline 3
|
set $curline 3
|
||||||
set $curcol 1
|
set $curcol 1
|
||||||
set $curchar 32
|
set $curchar 32
|
||||||
|
|
||||||
unmark-buffer
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
# Visualize Screen Dimensions
|
# Visualize Screen Dimensions
|
||||||
select-buffer screensize
|
|
||||||
insert-string &cat $curwidth &cat "x" $pagelen
|
insert-string &cat $curwidth &cat "x" $pagelen
|
||||||
insert-string &rig "---------+" &sub 10 $curcol
|
insert-string &rig "---------+" &sub 10 $curcol
|
||||||
&sub &div $curwidth 10 1 insert-string "---------+"
|
&sub &div $curwidth 10 1 insert-string "---------+"
|
||||||
|
Loading…
Reference in New Issue
Block a user