mirror of
https://github.com/rfivet/uemacs.git
synced 2025-01-03 06:56:29 -05:00
Use gcc predefined in conditional compilation (__CYGWIN__, __SIZEOF_WCHAR_T__).
This commit is contained in:
parent
18a0fbe57f
commit
5f3b42f448
18
Makefile
18
Makefile
@ -25,15 +25,15 @@ WARNINGS=-pedantic -Wall -Wextra -Wstrict-prototypes -Wno-unused-parameter
|
||||
CFLAGS=-O2 $(WARNINGS)
|
||||
LDFLAGS=-s
|
||||
LIBS=-lcurses
|
||||
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
|
||||
DEFINES=-DAUTOCONF -DPROGRAM=$(PROGRAM) -D_GNU_SOURCE # -DNDEBUG
|
||||
ifeq ($(uname_S),Linux) # __unix__ __linux__
|
||||
DEFINES += -DUSG -DPOSIX
|
||||
else ifeq ($(uname_S),CYGWIN) # __unix__ __CYGWIN__
|
||||
DEFINES += -DSYSV # -DPOSIX
|
||||
else ifeq ($(uname_S),MSYS) # __unix__ __CYGWIN__ __MSYS__
|
||||
DEFINES += -DSYSV # -DPOSIX
|
||||
else ifeq ($(uname_S),NetBSD) # __unix__ __NetBSD__
|
||||
DEFINES += -DBSD=1 -DPOSIX
|
||||
else
|
||||
$(error $(uname_S) needs configuration)
|
||||
endif
|
||||
|
28
posix.c
28
posix.c
@ -1,18 +1,16 @@
|
||||
/* posix.c -- posix implementation of termio.h */
|
||||
#ifdef POSIX
|
||||
|
||||
#include "termio.h"
|
||||
|
||||
/* posix.c
|
||||
*
|
||||
* The functions in this file negotiate with the operating system for
|
||||
* 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
|
||||
#ifdef POSIX
|
||||
|
||||
/* The functions in this file negotiate with the operating system for
|
||||
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>
|
||||
@ -38,7 +36,7 @@ int ttcol = HUGE ; /* Column location of HW cursor */
|
||||
#define XCASE 0000004
|
||||
#endif
|
||||
|
||||
#ifdef CYGWIN
|
||||
#ifdef __CYGWIN__ /* gcc predefined (see cpp -dM) */
|
||||
#define XCASE 0
|
||||
#define ECHOPRT 0
|
||||
#define PENDIN 0
|
||||
@ -247,8 +245,6 @@ int typahead(void)
|
||||
return x;
|
||||
}
|
||||
|
||||
#else
|
||||
typedef void _pedantic_empty_translation_unit ;
|
||||
#endif /* not POSIX */
|
||||
#endif
|
||||
|
||||
/* end of posix.c */
|
||||
|
24
termio.c
24
termio.c
@ -1,15 +1,13 @@
|
||||
/* termio.c -- implements termio.h */
|
||||
#if !defined( POSIX)
|
||||
|
||||
#include "termio.h"
|
||||
|
||||
/* TERMIO.C
|
||||
*
|
||||
* The functions in this file negotiate with the operating system for
|
||||
* characters, and write characters in a barely buffered fashion on the display.
|
||||
* All operating systems.
|
||||
*
|
||||
* modified by Petri Kutvonen
|
||||
#ifndef POSIX
|
||||
|
||||
/* The functions in this file negotiate with the operating system for
|
||||
characters, and write characters in a barely buffered fashion on the
|
||||
display. All operating systems.
|
||||
|
||||
modified by Petri Kutvonen
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -258,14 +256,12 @@ int typahead( void)
|
||||
return kbdqp;
|
||||
#endif
|
||||
|
||||
#if !UNIX
|
||||
# if !UNIX
|
||||
return FALSE;
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#else
|
||||
typedef void _pedantic_empty_translation_unit ;
|
||||
#endif /* not POSIX */
|
||||
|
||||
/* end of termio.c */
|
||||
|
7
utf8.c
7
utf8.c
@ -1,16 +1,13 @@
|
||||
/* utf8.c -- implements utf8.h, conversion between unicode and UTF-8 */
|
||||
#include "utf8.h"
|
||||
|
||||
#define _XOPEN_SOURCE /* wcwidth in wchar.h */
|
||||
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
#include <wchar.h> /* either _XOPEN_SOURCE or _GNU_SOURCE */
|
||||
|
||||
|
||||
/* Display width of UTF-8 character */
|
||||
int _utf8_width( unicode_t c) {
|
||||
#if CYGWIN
|
||||
assert( sizeof( wchar_t) == 2) ; /* wcwidth only supports UTF-16 */
|
||||
#if __SIZEOF_WCHAR_T__ == 2 /* wcwidth only supports UTF-16 */
|
||||
return (c < 0x10000) ? wcwidth( (wchar_t) c) : -1 ;
|
||||
#else
|
||||
return wcwidth( (wchar_t) c) ;
|
||||
|
Loading…
Reference in New Issue
Block a user