1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-06-09 13:30:43 +00:00

Recompile under MinGW32 with base framework for implementing kbd/screen (mingw32 + wscreen).

This commit is contained in:
Renaud 2014-06-18 14:59:40 +08:00
parent 45981e8793
commit 3be85dec65
12 changed files with 356 additions and 325 deletions

View File

@ -1,8 +1,8 @@
# Makefile for emacs, updated Thu, Oct 10, 2013 1:03:16 PM
# Makefile for emacs, updated Wed, Jun 18, 2014 2:24:32 PM
SRC=ansi.c basic.c bind.c bindable.c buffer.c crypt.c display.c ebind.c eval.c exec.c execute.c file.c fileio.c flook.c ibmpc.c input.c isearch.c line.c lock.c log.c main.c names.c pklock.c posix.c random.c region.c search.c spawn.c tcap.c termio.c utf8.c vmsvt.c vt52.c window.c word.c wrapper.c
OBJ=ansi.o basic.o bind.o bindable.o buffer.o crypt.o display.o ebind.o eval.o exec.o execute.o file.o fileio.o flook.o ibmpc.o input.o isearch.o line.o lock.o log.o main.o names.o pklock.o posix.o random.o region.o search.o spawn.o tcap.o termio.o utf8.o vmsvt.o vt52.o window.o word.o wrapper.o
HDR=basic.h bind.h bindable.h buffer.h crypt.h defines.h display.h ebind.h estruct.h eval.h exec.h execute.h file.h fileio.h flook.h input.h isearch.h line.h lock.h log.h names.h pklock.h random.h region.h retcode.h search.h spawn.h terminal.h termio.h utf8.h version.h window.h word.h wrapper.h
SRC=ansi.c basic.c bind.c bindable.c buffer.c crypt.c display.c ebind.c eval.c exec.c execute.c file.c fileio.c flook.c ibmpc.c input.c isearch.c line.c lock.c log.c main.c mingw32.c names.c pklock.c posix.c random.c region.c search.c spawn.c tcap.c termio.c utf8.c vmsvt.c vt52.c window.c word.c wrapper.c wscreen.c
OBJ=ansi.o basic.o bind.o bindable.o buffer.o crypt.o display.o ebind.o eval.o exec.o execute.o file.o fileio.o flook.o ibmpc.o input.o isearch.o line.o lock.o log.o main.o mingw32.o names.o pklock.o posix.o random.o region.o search.o spawn.o tcap.o termio.o utf8.o vmsvt.o vt52.o window.o word.o wrapper.o wscreen.o
HDR=basic.h bind.h bindable.h buffer.h crypt.h defines.h display.h ebind.h estruct.h eval.h exec.h execute.h file.h fileio.h flook.h input.h isearch.h line.h lock.h log.h names.h pklock.h random.h region.h retcode.h search.h spawn.h terminal.h termio.h utf8.h version.h window.h word.h wrapper.h wscreen.h
# DO NOT ADD OR MODIFY ANY LINES ABOVE THIS -- make source creates them
@ -40,13 +40,19 @@ ifeq ($(uname_S),Darwin)
endif
ifeq ($(uname_S),CYGWIN_NT-6.1-WOW64)
DEFINES=-DAUTOCONF -DCYGWIN -DPROGRAM=$(PROGRAM)
LIBS=-lcurses # SYSV
endif
ifeq ($(uname_S),CYGWIN_NT-6.1)
DEFINES=-DAUTOCONF -DCYGWIN -DPROGRAM=$(PROGRAM)
LIBS=-lcurses # SYSV
endif
ifeq ($(uname_S),MINGW32_NT-6.1)
DEFINES=-DAUTOCONF -DSYSV -DMINGW32 -DPROGRAM=$(PROGRAM)
LIBS=
endif
#DEFINES=-DAUTOCONF
#LIBS=-ltermcap # BSD
LIBS=-lcurses # SYSV
#LIBS=-lcurses # SYSV
#LIBS=-ltermlib
#LIBS=-L/usr/lib/termcap -ltermcap
LFLAGS=-hbx
@ -152,8 +158,8 @@ exec.o: exec.c exec.h retcode.h buffer.h crypt.h line.h utf8.h bind.h \
display.h estruct.h eval.h file.h flook.h input.h random.h window.h \
defines.h
execute.o: execute.c execute.h estruct.h bind.h random.h display.h file.h \
crypt.h retcode.h buffer.h line.h utf8.h terminal.h defines.h window.h
file.o: file.c file.h crypt.h retcode.h buffer.h line.h utf8.h defines.h \
buffer.h crypt.h line.h utf8.h retcode.h terminal.h defines.h window.h
file.o: file.c file.h buffer.h crypt.h line.h utf8.h retcode.h defines.h \
estruct.h execute.h fileio.h input.h bind.h lock.h log.h window.h
fileio.o: fileio.c fileio.h crypt.h retcode.h defines.h
flook.o: flook.c flook.h retcode.h defines.h fileio.h crypt.h
@ -170,6 +176,7 @@ log.o: log.c log.h retcode.h
main.o: main.c estruct.h basic.h bind.h bindable.h buffer.h crypt.h \
line.h utf8.h display.h eval.h execute.h file.h retcode.h input.h lock.h \
log.h random.h search.h terminal.h defines.h termio.h version.h window.h
mingw32.o: mingw32.c
names.o: names.c names.h basic.h bind.h bindable.h buffer.h crypt.h \
line.h utf8.h display.h eval.h exec.h retcode.h file.h isearch.h \
region.h random.h search.h spawn.h window.h defines.h word.h
@ -197,6 +204,7 @@ window.o: window.c window.h defines.h buffer.h crypt.h line.h utf8.h \
word.o: word.c word.h basic.h buffer.h crypt.h line.h utf8.h estruct.h \
log.h retcode.h random.h region.h window.h defines.h
wrapper.o: wrapper.c wrapper.h
wscreen.o: wscreen.c wscreen.h
# DEPENDENCIES MUST END AT END OF FILE
# IF YOU PUT STUFF HERE IT WILL GO AWAY

View File

@ -46,7 +46,7 @@ static const char modecode[] = "WCSEVOMYAUD" ; /* letters to represent modes */
static int makelist( int iflag) ;
static int addline( char *text) ;
static void ltoa( char *buf, int width, long num) ;
static void l_to_a( char *buf, int width, long num) ;
/*
@ -385,7 +385,7 @@ static int makelist( int iflag)
nbytes += (long) llength(lp) + 1L;
lp = lforw(lp);
}
ltoa( b, sizeof b, nbytes) ; /* 8 digits string buffer size. */
l_to_a( b, sizeof b, nbytes) ; /* 8 digits string buffer size. */
cp2 = &b[0];
while ((c = *cp2++) != 0)
*cp1++ = c;
@ -411,7 +411,7 @@ static int makelist( int iflag)
return TRUE; /* All done */
}
static void ltoa(char *buf, int width, long num)
static void l_to_a(char *buf, int width, long num)
{
buf[ --width] = 0 ; /* End of string. */
while (num >= 10) { /* Conditional digits. */

View File

@ -87,7 +87,9 @@ static void modeline(struct window *wp);
static void mlputi(int i, int r);
static void mlputli(long l, int r);
static void mlputf(int s);
#if SIGWINCH
static int newscreensize(int h, int w);
#endif
#if RAINBOW
static void putline(int row, int col, char *buf);

View File

@ -106,6 +106,17 @@
#define TERMCAP 0 /* Use TERMCAP */
#define IBMPC 1 /* IBM-PC CGA/MONO/EGA driver */
#elif defined( MINGW32)
#define VT220 (UNIX | VMS)
#define VT100 0
#define ANSI 0
#define VMSVT 0
#define VT52 0
#define TERMCAP 0
#define IBMPC 0
#else
#define VT220 (UNIX | VMS)

84
eval.c
View File

@ -348,17 +348,17 @@ char *gtfun(char *fname)
/* and now evaluate it! */
switch (fnum) {
case UFADD:
return itoa(atoi(arg1) + atoi(arg2));
return i_to_a(atoi(arg1) + atoi(arg2));
case UFSUB:
return itoa(atoi(arg1) - atoi(arg2));
return i_to_a(atoi(arg1) - atoi(arg2));
case UFTIMES:
return itoa(atoi(arg1) * atoi(arg2));
return i_to_a(atoi(arg1) * atoi(arg2));
case UFDIV:
return itoa(atoi(arg1) / atoi(arg2));
return i_to_a(atoi(arg1) / atoi(arg2));
case UFMOD:
return itoa(atoi(arg1) % atoi(arg2));
return i_to_a(atoi(arg1) % atoi(arg2));
case UFNEG:
return itoa(-atoi(arg1));
return i_to_a(-atoi(arg1));
case UFCAT:
strcpy(result, arg1);
return strcat(result, arg2);
@ -391,7 +391,7 @@ char *gtfun(char *fname)
case UFOR:
return ltos(stol(arg1) || stol(arg2));
case UFLENGTH:
return itoa(strlen(arg1));
return i_to_a(strlen(arg1));
case UFUPPER:
return mkupper(arg1);
case UFLOWER:
@ -399,7 +399,7 @@ char *gtfun(char *fname)
case UFTRUTH:
return ltos(atoi(arg1) == 42);
case UFASCII:
return itoa((int) arg1[0]);
return i_to_a((int) arg1[0]);
case UFCHR:
result[0] = atoi(arg1);
result[1] = 0;
@ -409,11 +409,11 @@ char *gtfun(char *fname)
result[1] = 0;
return result;
case UFRND:
return itoa((ernd() % abs(atoi(arg1))) + 1);
return i_to_a((ernd() % abs(atoi(arg1))) + 1);
case UFABS:
return itoa(abs(atoi(arg1)));
return i_to_a(abs(atoi(arg1)));
case UFSINDEX:
return itoa(sindex(arg1, arg2));
return i_to_a(sindex(arg1, arg2));
case UFENV:
#if ENVFUNC
tsp = getenv(arg1);
@ -429,13 +429,13 @@ char *gtfun(char *fname)
tsp = flook(arg1, TRUE);
return tsp == NULL ? "" : tsp;
case UFBAND:
return itoa(atoi(arg1) & atoi(arg2));
return i_to_a(atoi(arg1) & atoi(arg2));
case UFBOR:
return itoa(atoi(arg1) | atoi(arg2));
return i_to_a(atoi(arg1) | atoi(arg2));
case UFBXOR:
return itoa(atoi(arg1) ^ atoi(arg2));
return i_to_a(atoi(arg1) ^ atoi(arg2));
case UFBNOT:
return itoa(~atoi(arg1));
return i_to_a(~atoi(arg1));
case UFXLATE:
return xlat(arg1, arg2, arg3);
}
@ -497,19 +497,19 @@ char *gtenv(char *vname)
/* otherwise, fetch the appropriate value */
switch (vnum) {
case EVFILLCOL:
return itoa(fillcol);
return i_to_a(fillcol);
case EVPAGELEN:
return itoa(term.t_nrow + 1);
return i_to_a(term.t_nrow + 1);
case EVCURCOL:
return itoa(getccol(FALSE));
return i_to_a(getccol(FALSE));
case EVCURLINE:
return itoa(getcline());
return i_to_a(getcline());
case EVRAM:
return itoa((int) (envram / 1024l));
return i_to_a((int) (envram / 1024l));
case EVFLICKER:
return ltos(flickcode);
case EVCURWIDTH:
return itoa(term.t_ncol);
return i_to_a(term.t_ncol);
case EVCBUFNAME:
return curbp->b_bname;
case EVCFNAME:
@ -527,15 +527,15 @@ char *gtenv(char *vname)
}
case EVASAVE:
return itoa(gasave);
return i_to_a(gasave);
case EVACOUNT:
return itoa(gacount);
return i_to_a(gacount);
case EVLASTKEY:
return itoa(lastkey);
return i_to_a(lastkey);
case EVCURCHAR:
return (curwp->w_dotp->l_used ==
curwp->w_doto ? itoa('\n') :
itoa(lgetc(curwp->w_dotp, curwp->w_doto)));
curwp->w_doto ? i_to_a('\n') :
i_to_a(lgetc(curwp->w_dotp, curwp->w_doto)));
case EVDISCMD:
return ltos(discmd);
case EVVERSION:
@ -543,16 +543,16 @@ char *gtenv(char *vname)
case EVPROGNAME:
return PROGRAM_NAME_LONG;
case EVSEED:
return itoa(seed);
return i_to_a(seed);
case EVDISINP:
return ltos(disinp);
case EVWLINE:
return itoa(curwp->w_ntrows);
return i_to_a(curwp->w_ntrows);
case EVCWLINE:
return itoa(getwpos());
return i_to_a(getwpos());
case EVTARGET:
saveflag = lastflag;
return itoa(curgoal);
return i_to_a(curgoal);
case EVSEARCH:
return pat;
case EVREPLACE:
@ -562,11 +562,11 @@ char *gtenv(char *vname)
case EVKILL:
return getkill();
case EVCMODE:
return itoa(curbp->b_mode);
return i_to_a(curbp->b_mode);
case EVGMODE:
return itoa(gmode);
return i_to_a(gmode);
case EVTPAUSE:
return itoa(term.t_pause);
return i_to_a(term.t_pause);
case EVPENDING:
#if TYPEAH
return ltos(typahead());
@ -574,19 +574,19 @@ char *gtenv(char *vname)
return falsem;
#endif
case EVLWIDTH:
return itoa(llength(curwp->w_dotp));
return i_to_a(llength(curwp->w_dotp));
case EVLINE:
return getctext();
case EVGFLAGS:
return itoa(gflags);
return i_to_a(gflags);
case EVRVAL:
return itoa(rval);
return i_to_a(rval);
case EVTAB:
return itoa(tabmask + 1);
return i_to_a(tabmask + 1);
case EVOVERLAP:
return itoa(overlap);
return i_to_a(overlap);
case EVSCROLLCOUNT:
return itoa(scrollcount);
return i_to_a(scrollcount);
#if SCROLLCODE
case EVSCROLL:
return ltos(term.t_scroll != NULL);
@ -632,7 +632,7 @@ int setvar(int f, int n)
/* get the value for that variable */
if (f == TRUE)
strcpy(value, itoa(n));
strcpy(value, i_to_a(n));
else {
status = mlreply("Value: ", &value[0], NSTRING);
if (status != TRUE)
@ -929,13 +929,13 @@ static int svar(struct variable_description *var, char *value)
}
/*
* itoa:
* i_to_a:
* integer to ascii string.......... This is too
* inconsistant to use the system's
*
* int i; integer to translate to a string
*/
char *itoa(int i)
char *i_to_a(int i)
{
#define INTWIDTH sizeof( int) * 3

2
eval.h
View File

@ -43,7 +43,7 @@ char *gtfun( char *fname) ;
char *gtusr( char *vname) ;
char *gtenv( char *vname) ;
int setvar( int f, int n) ;
char *itoa( int i) ;
char *i_to_a( int i) ;
char *getval( char *token) ;
int stol( char *val) ;
char *mkupper( char *str) ;

2
exec.c
View File

@ -629,7 +629,7 @@ static int dobuf(struct buffer *bp)
strcat(outline, ":");
/* debug if levels */
strcat(outline, itoa(execlevel));
strcat(outline, i_to_a(execlevel));
strcat(outline, ":");
/* and lastly the line */

2
main.c
View File

@ -296,7 +296,9 @@ int main(int argc, char **argv)
}
#if UNIX
#ifdef SIGHUP
signal(SIGHUP, emergencyexit);
#endif
signal(SIGTERM, emergencyexit);
#endif

View File

@ -102,7 +102,7 @@ int spawncli(int f, int n)
system("exec /bin/sh");
#endif
sgarbf = TRUE;
sleep(2);
usleep( 2000000L) ;
TTopen();
TTkopen();
#ifdef SIGWINCH

2
tcap.c
View File

@ -19,6 +19,7 @@
#define USE_BROKEN_OPTIMIZATION 0
#define termdef 1 /* Don't define "term" external. */
#ifndef MINGW32
#ifdef CYGWIN
#include <ncurses/curses.h>
#include <ncurses/term.h>
@ -26,6 +27,7 @@
#include <curses.h>
#include <term.h>
#endif
#endif
#include "display.h"
#include "estruct.h"

View File

@ -9,7 +9,7 @@
* modified by Petri Kutvonen
*/
#ifndef POSIX
#if !defined( POSIX) && !defined( MINGW32)
#include <stdio.h>
#include <stdlib.h>

View File

@ -6,6 +6,12 @@
#include <stdlib.h>
#include <unistd.h>
#ifdef MINGW32
int mkstemp( char *template) {
return -1 ;
}
#endif
static void die( const char *err) {
fprintf( stderr, "fatal: %s\n", err) ;
exit( EXIT_FAILURE) ;