Sat Mar 7 14:43:27 1998 Pavel Roskin <pavel@absolute.spb.su>

* nt/Makefile.NT, nt/Makefile.VC4: rewritten for GNU make.
        Use gmake -f Makefile.VC4 to compile.

        * nt/*.c: config.h is included before all other code.

        * nt/config.h: added some definitions, because some
        compilers don't accept long command lines.

        * nt/Makefile.VC1: removed :-( It didn't work anyways.

        * nt/slint.nt.c: can be compiled under OS/2 too

        * nt/key.nt.c: correct_key_code was called twice. Shifted
        functional keys supported. Alt-F1 and Alt-F2 work as F11 and F12.
        Alt-F7 works as Shift-Alt-? (used for find file). Function
        alt_pressed() and ctrl_pressed() introduced.
This commit is contained in:
Miguel de Icaza 1998-03-07 20:36:45 +00:00
parent 177bbf7262
commit 74c6330a30
14 changed files with 246 additions and 228 deletions

20
nt/ChangeLog Normal file
View File

@ -0,0 +1,20 @@
Sat Mar 7 14:43:27 1998 Pavel Roskin <pavel@absolute.spb.su>
* nt/Makefile.NT, nt/Makefile.VC4: rewritten for GNU make.
Use gmake -f Makefile.VC4 to compile.
* nt/*.c: config.h is included before all other code.
* nt/config.h: added some definitions, because some
compilers don't accept long command lines.
* nt/Makefile.VC1: removed :-( It didn't work anyways.
* nt/slint.nt.c: can be compiled under OS/2 too
* nt/key.nt.c: correct_key_code was called twice. Shifted
functional keys supported. Alt-F1 and Alt-F2 work as F11 and F12.
Alt-F7 works as Shift-Alt-? (used for find file). Function
alt_pressed() and ctrl_pressed() introduced.

View File

@ -10,7 +10,7 @@ include ../Make.common
FILES = Makefile TODO dirent.c mc.ico bugs mc.rc config.h dirent.h \ FILES = Makefile TODO dirent.c mc.ico bugs mc.rc config.h dirent.h \
Makefile.NT chmod.nt.c drive.nt.c slint.nt.c cons.handler.nt.c \ Makefile.NT chmod.nt.c drive.nt.c slint.nt.c cons.handler.nt.c \
key.nt.c utilnt.c Makefile.NT Makefile.VC1 Makefile.VC4 \ key.nt.c utilnt.c Makefile.NT Makefile.VC4 \
util.WinNT.c util.debug.c util.Win32.c util.Win32.h util.debug.h \ util.WinNT.c util.debug.c util.Win32.c util.Win32.h util.debug.h \
drive.h drive.h

View File

@ -3,176 +3,151 @@
# 970423 hacked by Juan f. Grigera # 970423 hacked by Juan f. Grigera
# 970525 hacked again by jfg to add internal editor # 970525 hacked again by jfg to add internal editor
# 971127 hacked by Pavel Roskin to make it work with mc-4.1.11 # 971127 hacked by Pavel Roskin to make it work with mc-4.1.11
# 980206 hacked by Pavel Roskin to make it work with GNU make
# #
# This is the Makefile for Midnight Commander under Win32. # This is the Makefile for Midnight Commander under Win32.
# #
# Supported Compilers: # Supported Compilers:
# #
# makefile.vc4: Microsoft Visual C++ 4.x # makefile.vc4: Microsoft Visual C++ 4.x
# ... # ...
!IF "$(DEBUG)" == ""
DEBUG=1
!MESSAGE No configuration specified. Defaulting to Debug.
!ENDIF
!if "$(DEBUG)" == "0"
OBJS_DIR=release
!else
OBJS_DIR=debug
!endif
NULL=nul
# ---- Directories # ---- Directories
MC_NT_DIR=. MC_NT_DIR=../nt
MC_SRC_DIR=..\src MC_SRC_DIR=../src
MC_INCLUDE_DIR=. MC_INCLUDE_DIR=.
VFS_DIR=..\vfs VFS_DIR=../vfs
MCEDIT_SRC_DIR=..\edit MCEDIT_SRC_DIR=../edit
MCEDIT_OBJS_DIR=$(MCEDIT_SRC_DIR)\$(OBJS_DIR) MCEDIT_OBJS_DIR=$(OBJS_DIR)/edit
MCEDIT_LIB=$(MCEDIT_OBJS_DIR)\libedit.lib SLANG_SRC_DIR=../slang
SLANG_SRC_DIR=..\slang SLANG_OBJS_DIR=$(OBJS_DIR)/slang
SLANG_OBJS_DIR=$(SLANG_SRC_DIR)\$(OBJS_DIR)
SLANG_LIB=$(SLANG_OBJS_DIR)\slang.lib
# ---- Compiler specific defines
!include "makefile.vc4"
# --- Midnight Defines # --- Midnight Defines
MC_DEFINES=$(SPECIFIC_DEFINES) -D_OS_NT -DOS2_NT -DWIN32 -D_CONSOLE -DHAVE_CONFIG_H -Dpc_system -DUSE_INTERNAL_EDIT MC_DEFINES=$(SPECIFIC_DEFINES) -D_CONSOLE -DHAVE_CONFIG_H -DUSE_INTERNAL_EDIT
MC_INCLUDES=-I$(MC_SRC_DIR) -I$(MC_NT_DIR) -I$(SLANG_SRC_DIR) MC_INCLUDES=-I$(MC_SRC_DIR) -I$(MC_NT_DIR) -I$(SLANG_SRC_DIR)
SLANG_DEFINES=$(SPECIFIC_DEFINES) -DWIN32 -DWIN32_LEAN_AND_MEAN -D_WINDOWS -Dpc_system -Dpc -D_OS_NT -D__WIN32__ -D__STDC__ -DHAVE_STDLIB_H -DFLOAT_TYPE -DMSWINDOWS -DHAVE_MEMCPY -DHAVE_MEMSET SLANG_DEFINES=$(SPECIFIC_DEFINES)
SLANG_INCLUDES=-I$(MC_NT_DIR) -I$(SLANG_SRC_DIR) SLANG_INCLUDES=-I$(MC_NT_DIR) -I$(SLANG_SRC_DIR)
MCEDIT_DEFINES=$(SPECIFIC_DEFINES) -D_OS_NT -DWIN32 -D_CONSOLE -DHAVE_CONFIG_H -DMIDNIGHT MCEDIT_DEFINES=$(SPECIFIC_DEFINES) -D_CONSOLE -DHAVE_CONFIG_H
MCEDIT_INCLUDES=-I$(MC_SRC_DIR) -I$(MC_NT_DIR) -I$(MC_SRC_DIR)\.. -I$(SLANG_SRC_DIR) MCEDIT_INCLUDES=-I$(MC_NT_DIR) -I$(MC_SRC_DIR)/.. -I$(SLANG_SRC_DIR)
CFLAGS=$(SPECIFIC_MC_CFLAGS) $(MC_INCLUDES) $(MC_DEFINES) -c CFLAGS=$(SPECIFIC_MC_CFLAGS) $(MC_INCLUDES) $(MC_DEFINES) -c
LFLAGS=$(MC_LIBS) $(SLANG_LIB) $(MCEDIT_LIB) $(SPECIFIC_MC_LFLAGS)
SLANG_CFLAGS=$(SPECIFIC_SLANG_CFLAGS) $(SLANG_INCLUDES) $(SLANG_DEFINES) -c SLANG_CFLAGS=$(SPECIFIC_SLANG_CFLAGS) $(SLANG_INCLUDES) $(SLANG_DEFINES) -c
SLANG_LINK_FLAGS=-nologo -out:"$(SLANG_LIB)"
MCEDIT_CFLAGS=$(SPECIFIC_MCEDIT_CFLAGS) $(MCEDIT_INCLUDES) $(MCEDIT_DEFINES) -c MCEDIT_CFLAGS=$(SPECIFIC_MCEDIT_CFLAGS) $(MCEDIT_INCLUDES) $(MCEDIT_DEFINES) -c
MCEDIT_LINK_FLAGS=-nologo -out:"$(MCEDIT_LIB)" RSC_FLAGS=$(RES_PLACE)$(OBJS_DIR)/mc.res $(RC_DEFINES)
RC_DEFINES=$(SPECIFIC_DEFINES)
RSC_FLAGS=-l 0x409 -fo"$(OBJS_DIR)\mc.res" $(RC_DEFINES)
# --- Dependencies
.PHONY: all object-dirs mc clean
all: object-dirs mc all: object-dirs mc
object-dirs: $(OBJS_DIR) $(SLANG_OBJS_DIR) $(MCEDIT_OBJS_DIR) object-dirs: $(OBJS_DIR) $(SLANG_OBJS_DIR) $(MCEDIT_OBJS_DIR)
mc: $(OBJS_DIR)\mc.exe mc: $(MC_EXE)
slang: $(SLANG_LIB)
libedit: $(MCEDIT_LIB)
clean: clean:
deltree -y $(OBJS_DIR) deltree -y "$(SLANG_OBJS_DIR)"
deltree -y $(SLANG_OBJS_DIR) deltree -y "$(MCEDIT_OBJS_DIR)"
deltree -y $(MCEDIT_OBJS_DIR) deltree -y "$(OBJS_DIR)"
$(OBJS_DIR): $(OBJS_DIR):
if not exist $@\$(NULL) mkdir $@ mkdir "$@"
$(SLANG_OBJS_DIR): $(SLANG_OBJS_DIR):
if not exist $@\$(NULL) mkdir $@ mkdir "$@"
$(MCEDIT_OBJS_DIR): $(MCEDIT_OBJS_DIR):
if not exist $@\$(NULL) mkdir $@ mkdir "$@"
.c{$(OBJS_DIR)}.obj: $(OBJS_DIR)/%.$(OBJ_SUFFIX): $(MC_NT_DIR)/%.c
$(CC) $(CFLAGS) -Fo$@ $< $(CC) $(CFLAGS) $(OBJ_PLACE)$@ $<
{$(MC_SRC_DIR)}.c{$(OBJS_DIR)}.obj: $(OBJS_DIR)/%.$(OBJ_SUFFIX): $(MC_SRC_DIR)/%.c
$(CC) $(CFLAGS) -Fo$@ $< $(CC) $(CFLAGS) $(OBJ_PLACE)$@ $<
{$(SLANG_SRC_DIR)}.c{$(SLANG_OBJS_DIR)}.obj: $(SLANG_OBJS_DIR)/%.$(OBJ_SUFFIX): $(SLANG_SRC_DIR)/%.c
$(CC) $(SLANG_CFLAGS) -Fo$@ $< $(CC) $(SLANG_CFLAGS) $(OBJ_PLACE)$@ $<
{$(MCEDIT_SRC_DIR)}.c{$(MCEDIT_OBJS_DIR)}.obj: $(MCEDIT_OBJS_DIR)/%.$(OBJ_SUFFIX): $(MCEDIT_SRC_DIR)/%.c
$(CC) $(MCEDIT_CFLAGS) -Fo$@ $< $(CC) $(MCEDIT_CFLAGS) $(OBJ_PLACE)$@ $<
OBJS= $(EXTRA_MC_OBJS)\ SRCS= $(EXTRA_MC_SRCS) \
$(OBJS_DIR)\util.Win32.obj\ util.Win32.c \
$(OBJS_DIR)\util.WinNT.obj\ util.WinNT.c \
$(OBJS_DIR)\terms.obj \ terms.c \
$(OBJS_DIR)\user.obj \ user.c \
$(OBJS_DIR)\utilnt.obj \ utilnt.c \
$(OBJS_DIR)\subshell.obj \ subshell.c \
$(OBJS_DIR)\file.obj \ file.c \
$(OBJS_DIR)\listmode.obj \ listmode.c \
$(OBJS_DIR)\cmd.obj \ cmd.c \
$(OBJS_DIR)\dirent.obj \ dirent.c \
$(OBJS_DIR)\command.obj \ command.c \
$(OBJS_DIR)\help.obj \ help.c \
$(OBJS_DIR)\menu.obj \ menu.c \
$(OBJS_DIR)\view.obj \ view.c \
$(OBJS_DIR)\dir.obj \ dir.c \
$(OBJS_DIR)\info.obj \ info.c \
$(OBJS_DIR)\widget.obj \ widget.c \
$(OBJS_DIR)\cons.handler.nt.obj \ cons.handler.nt.c \
$(OBJS_DIR)\option.obj \ option.c \
$(OBJS_DIR)\dlg.obj \ dlg.c \
$(OBJS_DIR)\panelize.obj \ panelize.c \
$(OBJS_DIR)\profile.obj \ profile.c \
$(OBJS_DIR)\util.obj \ util.c \
$(OBJS_DIR)\dialog.obj \ dialog.c \
$(OBJS_DIR)\ext.obj \ ext.c \
$(OBJS_DIR)\color.obj \ color.c \
$(OBJS_DIR)\drive.nt.obj \ drive.nt.c \
$(OBJS_DIR)\key.nt.obj \ key.nt.c \
$(OBJS_DIR)\layout.obj \ layout.c \
$(OBJS_DIR)\setup.obj \ setup.c \
$(OBJS_DIR)\regex.obj \ regex.c \
$(OBJS_DIR)\hotlist.obj \ hotlist.c \
$(OBJS_DIR)\slint.nt.obj \ slint.nt.c \
$(OBJS_DIR)\tree.obj \ tree.c \
$(OBJS_DIR)\win.obj \ win.c \
$(OBJS_DIR)\chmod.nt.obj \ chmod.nt.c \
$(OBJS_DIR)\complete.obj \ complete.c \
$(OBJS_DIR)\find.obj \ find.c \
$(OBJS_DIR)\wtools.obj \ wtools.c \
$(OBJS_DIR)\boxes.obj \ boxes.c \
$(OBJS_DIR)\background.obj \ background.c \
$(OBJS_DIR)\dirhist.obj \ dirhist.c \
$(OBJS_DIR)\main.obj \ main.c \
$(OBJS_DIR)\popt.obj \ popt.c \
$(OBJS_DIR)\mouse.obj \ mouse.c \
$(OBJS_DIR)\text.obj \ text.c \
$(OBJS_DIR)\screen.obj screen.c
MC_RES=$(OBJS_DIR)\mc.res SLANG_SRCS= \
slw32tty.c \
slerr.c \
slgetkey.c \
slsmg.c \
slvideo.c
SLANG_OBJS= \ MCEDIT_SRCS= \
$(SLANG_OBJS_DIR)\slw32tty.obj \ edit.c \
$(SLANG_OBJS_DIR)\slerr.obj \ editcmd.c \
$(SLANG_OBJS_DIR)\slgetkey.obj \ editdraw.c \
$(SLANG_OBJS_DIR)\slsmg.obj \ editmenu.c \
$(SLANG_OBJS_DIR)\slvideo.obj editoptions.c \
editwidget.c \
wordproc.c
MCEDIT_OBJS= \ OBJS=$(addprefix $(OBJS_DIR)/, \
$(MCEDIT_OBJS_DIR)\edit.obj\ $(patsubst %.c,%.$(OBJ_SUFFIX),$(SRCS)))
$(MCEDIT_OBJS_DIR)\editcmd.obj\
$(MCEDIT_OBJS_DIR)\editdraw.obj\
$(MCEDIT_OBJS_DIR)\editmenu.obj\
$(MCEDIT_OBJS_DIR)\editoptions.obj\
$(MCEDIT_OBJS_DIR)\editwidget.obj\
$(MCEDIT_OBJS_DIR)\wordproc.obj
$(OBJS_DIR)\mc.exe : $(OBJS_DIR) $(SLANG_LIB) $(MCEDIT_LIB) $(MC_RES) $(DEF_FILE) $(OBJS) SLANG_OBJS=$(addprefix $(SLANG_OBJS_DIR)/, \
$(LINK) $(LFLAGS) $(OBJS) $(patsubst %.c,%.$(OBJ_SUFFIX),$(SLANG_SRCS)))
$(MC_NT_DIR)\mc.rc: $(MC_NT_DIR)\mc.ico $(MC_NT_DIR)\config.h ..\VERSION MCEDIT_OBJS=$(addprefix $(MCEDIT_OBJS_DIR)/, \
$(patsubst %.c,%.$(OBJ_SUFFIX),$(MCEDIT_SRCS)))
$(OBJS_DIR)\mc.res : $(MC_NT_DIR)\mc.rc $(OBJS_DIR) # --- Resources
$(RSC) $(RSC_FLAGS) $(MC_NT_DIR)\mc.rc ifdef RSC
MC_RES=$(OBJS_DIR)/mc.res
$(OBJS_DIR)\Mc.bsc : $(OBJS_DIR) $(BSC32_SBRS) else
$(BSC32) $(BSC32_FLAGS) $(BSC32_SBRS) MC_RES=
endif
$(SLANG_LIB) : $(SLANG_OBJS_DIR) $(SLANG_OBJS)
$(SLANG_LINK) $(SLANG_LINK_FLAGS) $(SLANG_OBJS)
$(MCEDIT_LIB) : $(MCEDIT_OBJS_DIR) $(MCEDIT_OBJS)
$(MCEDIT_LINK) $(MCEDIT_LINK_FLAGS) $(MCEDIT_OBJS)
$(OBJS_DIR)/mc.res: $(MC_NT_DIR)/mc.rc $(MC_NT_DIR)/mc.ico $(MC_NT_DIR)/config.h ../VERSION
$(RSC) $(RSC_FLAGS) $(MC_NT_DIR)/mc.rc

View File

@ -5,33 +5,61 @@
# #
# Hacked by Dan Nicolaescu from Visual IDE mak # Hacked by Dan Nicolaescu from Visual IDE mak
# Hacked by Pavel Roskin to make it work with cmd.exe from Windows NT4 # Hacked by Pavel Roskin to make it work with cmd.exe from Windows NT4
# 980206 hacked by Pavel Roskin to make it work with GNU make
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
MC_LIBS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib MC_LIBS=advapi32.lib
NOLOGO=-nologo
MC_MISC_CFLAGS=-Fp"$(OBJS_DIR)\Mc.pch"
# ---- Path (case-sensitive!) is searched for executables
# If the command line contains quotes, it is passed to shell
# Errors are ignored in this case!
Path=c:/msdev/bin
CC=cl.exe CC=cl.exe
# Just comment RSC out if you have problems with resources
RSC=rc.exe RSC=rc.exe
LINK=link.exe LINK=link.exe
BSC=bscmake.exe OBJ_SUFFIX=obj
SLANG_LINK=link.exe -lib OBJ_PLACE=-Fo
MCEDIT_LINK=link.exe -lib RES_PLACE=-fo
EXE_PLACE=-out:
!if "$(DEBUG)" == "0" # ---- Compiler-specific optional stuff
EXTRA_MC_OBJS= MC_MISC_CFLAGS=-nologo -YX -Fp$(OBJS_DIR)/mc.pch
SPECIFIC_DEFINES=
SPECIFIC_MC_CFLAGS=$(NOLOGO) -ML -GX -O2 -YX0 $(MC_MISC_CFLAGS) ifndef RELEASE
SPECIFIC_MC_LFLAGS_EXTRA=-incremental:no # ---- Debug build
SPECIFIC_SLANG_CFLAGS=-ML -W3 -GX -O2 -YX -Fp"$(SLANG_OBJS_DIR)\slang.pch" OBJS_DIR=debug
SPECIFIC_MCEDIT_CFLAGS=-ML -W3 -GX -O2 -YX -Fp"$(MCEDIT_OBJS_DIR)\libedit.pch" EXTRA_MC_SRCS=util.debug.c
!else
EXTRA_MC_OBJS=$(OBJS_DIR)\util.debug.obj
SPECIFIC_DEFINES=-DHAVE_TRACE SPECIFIC_DEFINES=-DHAVE_TRACE
SPECIFIC_MC_CFLAGS=$(NOLOGO) -MLd -Gm -GX -Zi -Od -YX -Fd"$(OBJS_DIR)\\" $(MC_MISC_CFLAGS) SPECIFIC_MC_CFLAGS=-MLd -W3 -Gm -Zi -Od -Fd$(OBJS_DIR)/mc.pdb $(MC_MISC_CFLAGS)
SPECIFIC_MC_LFLAGS_EXTRA=-debug -incremental:yes SPECIFIC_MC_LFLAGS_EXTRA=-debug -incremental:yes
SPECIFIC_SLANG_CFLAGS=-MLd -W3 -GX -Zi -Od -YX -Fr"$(SLANG_OBJS_DIR)\\" -Fp"$(SLANG_OBJS_DIR)\slang.pch" SPECIFIC_SLANG_CFLAGS=$(SPECIFIC_MC_CFLAGS)
SPECIFIC_MCEDIT_CFLAGS=-MLd -W3 -GX -Zi -Od -YX -Fr"$(MCEDIT_OBJS_DIR)\\" -Fp"$(MCEDIT_OBJS_DIR)\libedit.pch" SPECIFIC_MCEDIT_CFLAGS=$(SPECIFIC_MC_CFLAGS)
!endif RC_DEFINES=-D_DEBUG
else
# ---- Release build
OBJS_DIR=release
EXTRA_MC_SRCS=
SPECIFIC_DEFINES=
SPECIFIC_MC_CFLAGS=-ML -W3 -O2 $(MC_MISC_CFLAGS)
SPECIFIC_MC_LFLAGS_EXTRA=-incremental:no
SPECIFIC_SLANG_CFLAGS=$(SPECIFIC_MC_CFLAGS)
SPECIFIC_MCEDIT_CFLAGS=$(SPECIFIC_MC_CFLAGS)
RC_DEFINES=-DRELEASE=$(RELEASE)
endif
SPECIFIC_MC_LFLAGS=-subsystem:console -pdb:"$(OBJS_DIR)\Mc.pdb" -machine:I386 -out:"$(OBJS_DIR)\Mc.exe" $(SPECIFIC_MC_LFLAGS_EXTRA) MC_EXE=$(OBJS_DIR)/mc.exe
# ---- Compiler independent defines
include Makefile.NT
# ---- Linkers are usualy compiler-specific
SPECIFIC_MC_LFLAGS= \
-nologo \
-subsystem:console \
-pdb:$(OBJS_DIR)/mc.pdb \
-machine:I386 \
$(SPECIFIC_MC_LFLAGS_EXTRA)
$(MC_EXE): $(MC_RES) $(OBJS) $(MCEDIT_OBJS) $(SLANG_OBJS)
$(LINK) $(EXE_PLACE)$(MC_EXE) $(MC_LIBS) $(SPECIFIC_MC_LFLAGS) $+

View File

@ -18,11 +18,11 @@
- Preliminar. Work to be done here. (Maybe should write a command to - Preliminar. Work to be done here. (Maybe should write a command to
change attributes and another to change rwx permissions. change attributes and another to change rwx permissions.
*/ */
#include <config.h>
#ifndef _OS_NT #ifndef _OS_NT
#error This file is for the NT operating system. #error This file is for the NT operating system.
#else #else
#include <config.h>
#include <windows.h> #include <windows.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@ -321,17 +321,10 @@ static void apply_mask (struct stat *sf)
} while (cpanel->marked); } while (cpanel->marked);
} }
/* .ado: Chmod can now remove the R-flag */
static int my_chmod (char *path, int mode) static int my_chmod (char *path, int mode)
{ {
/* From _chmod MSVC:Crt\Src\CHMOD.C */ SetFileAttributes(path, mode);
/* just set new attribute */ return (GetFileAttributes(path) != mode);
if (!SetFileAttributes((LPTSTR)path, mode)) {
/* error occured -- map error code and return */
_dosmaperr(GetLastError());
return -1;
}
return 0;
} }
void chmod_cmd (void) void chmod_cmd (void)

View File

@ -30,12 +30,33 @@
#ifndef __CONFIG_HPP //Prevent multiple includes #ifndef __CONFIG_HPP //Prevent multiple includes
#define __CONFIG_HPP #define __CONFIG_HPP
#include <../VERSION> #include <../VERSION>
#ifndef WIN32
# define WIN32
#endif
#ifndef __WIN32__
# define __WIN32__
#endif
#ifndef MSWINDOWS
# define MSWINDOWS
#endif
#ifndef pc_system
# define pc_system
#endif
#define _OS_NT
#define OS2_NT
#define FLOAT_TYPE
#define MIDNIGHT
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Headers // Headers
#define STDC_HEADERS #define STDC_HEADERS
#define HAVE_STDLIB_H
#define HAVE_STRING_H #define HAVE_STRING_H
#define HAVE_DIRENT_H #define HAVE_DIRENT_H
#define HAVE_LIMITS_H #define HAVE_LIMITS_H
@ -45,12 +66,14 @@
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// "Standard" Library // "Standard" Library
#define HAS_MEMSET #define HAVE_MEMSET
#define HAS_MEMCHR #define HAVE_MEMCHR
#define HAS_MEMCPY #define HAVE_MEMCPY
#define HAS_MEMCMP #define HAVE_MEMCMP
#define HAVE_MEMMOVE
#define HAVE_STRDUP #define HAVE_STRDUP
#define HAVE_STRERROR #define HAVE_STRERROR
#define HAVE_TRUNCATE
#define REGEX_MALLOC #define REGEX_MALLOC
@ -137,6 +160,4 @@ typedef unsigned int nlink_t;
#define pclose _pclose #define pclose _pclose
#define pipe(p) _pipe(p, 4096, 0x8000 /*_O_BINARY*/) #define pipe(p) _pipe(p, 4096, 0x8000 /*_O_BINARY*/)
#define OS2_NT 1
#endif //__CONFIG_HPP #endif //__CONFIG_HPP

View File

@ -20,11 +20,11 @@
show_console_contents doesn't know how to write to its window show_console_contents doesn't know how to write to its window
the rest works fine. the rest works fine.
*/ */
#include <config.h>
#ifndef _OS_NT #ifndef _OS_NT
#error This file is for Win32 operating systems. #error This file is for Win32 operating systems.
#else #else
#include <config.h>
#include <windows.h> #include <windows.h>
#include "util.debug.h" #include "util.debug.h"

View File

@ -19,11 +19,11 @@
can fit in a panel. can fit in a panel.
*/ */
#include <config.h>
#ifndef _OS_NT #ifndef _OS_NT
#error This file is for the Win32 operating systems. #error This file is for the Win32 operating systems.
#else #else
#include <config.h>
#include <windows.h> #include <windows.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>

View File

@ -18,17 +18,12 @@
Bugs: Bugs:
Have trouble with non-US keyboards, "Alt-gr"+keys (API tells CTRL-ALT is pressed) Have trouble with non-US keyboards, "Alt-gr"+keys (API tells CTRL-ALT is pressed)
*/ */
#include <config.h>
#ifndef _OS_NT #ifndef _OS_NT
#error This file is for Win32 systems. #error This file is for Win32 systems.
#else #else
#include <windows.h> #include <windows.h>
/* Linux and Win32 names are the same, but values are different */
const int win_shift_pressed = SHIFT_PRESSED;
#undef SHIFT_PRESSED
#include <config.h>
#include <stdio.h> #include <stdio.h>
#include "mouse.h" #include "mouse.h"
#include "global.h" #include "global.h"
@ -191,7 +186,7 @@ pend_send:
pending_keys = 0; pending_keys = 0;
seq_append = 0; seq_append = 0;
} }
return correct_key_code (d); return d;
} }
@ -206,8 +201,8 @@ pend_send:
ch = ir.Event.KeyEvent.uChar.AsciiChar; ch = ir.Event.KeyEvent.uChar.AsciiChar;
dwSaved_ControlState = ir.Event.KeyEvent.dwControlKeyState; dwSaved_ControlState = ir.Event.KeyEvent.dwControlKeyState;
j = VKtoCurses(vkcode); j = VKtoCurses(vkcode);
return correct_key_code (j ? j : ch); return j ? j : ch;
case MOUSE_EVENT: case MOUSE_EVENT:
// Save event as a GPM-like event // Save event as a GPM-like event
@ -246,39 +241,23 @@ static int VKtoCurses (int a_vkc)
static int correct_key_code (int c) static int correct_key_code (int c)
{ {
static char AltGrPressed = 0;
/* Ugly hacks */
/* Make Ctrl-Tab same as reserved Alt-Tab */
if (c == '\t' && ctrl_pressed())
c = ALT('\t');
/* FIXME: Ignore Left-Ctrl+Right-Alt combination in non-US keyboards,
as it means Alt-Gr+key */
if (dwSaved_ControlState & RIGHT_ALT_PRESSED &&
dwSaved_ControlState & LEFT_CTRL_PRESSED)
return c;
/* No, AltGR Key is the combination with ENHANCED_KEY
and RIGHT_ALT_PRESSED .ado */
if (dwSaved_ControlState & RIGHT_ALT_PRESSED &&
dwSaved_ControlState & ENHANCED_KEY) {
/* AltGr Key pressed */
AltGrPressed = 1;
return c;
}
/* Other hacks */
/* Check Control State */ /* Check Control State */
if (ctrl_pressed()) if (ctrl_pressed())
c = XCTRL(c); if (c == '\t')
if (!AltGrPressed && /* Make Ctrl-Tab same as reserved Alt-Tab */
(dwSaved_ControlState & RIGHT_ALT_PRESSED || c = ALT('\t');
dwSaved_ControlState & LEFT_ALT_PRESSED)) else
c = ALT(c); c = XCTRL(c);
else
AltGrPressed = 0;
if (alt_pressed())
c = ALT(c);
if (shift_pressed() && (c >= KEY_F(1)) && (c <= KEY_F(10)))
c += 10;
if (alt_pressed() && (c >= KEY_F(1)) && (c <= KEY_F(2)))
c += 10;
if (alt_pressed() && (c == KEY_F(7)))
c = ALT('?');
switch (c) { switch (c) {
case KEY_KP_ADD: case KEY_KP_ADD:
c = alternate_plus_minus ? ALT('+') : '+'; c = alternate_plus_minus ? ALT('+') : '+';
@ -419,8 +398,6 @@ int is_idle (void)
return 1; return 1;
} }
extern long SLsys_GetLastkeyControlState ();
/* get_modifier */ /* get_modifier */
int get_modifier() int get_modifier()
{ {
@ -435,7 +412,7 @@ int get_modifier()
dwSaved_ControlState & LEFT_CTRL_PRESSED) dwSaved_ControlState & LEFT_CTRL_PRESSED)
retval |= CONTROL_PRESSED; retval |= CONTROL_PRESSED;
if (dwSaved_ControlState & win_shift_pressed) if (dwSaved_ControlState & SHIFT_PRESSED)
retval |= SHIFT_PRESSED; retval |= SHIFT_PRESSED;
return retval; return retval;
@ -443,12 +420,19 @@ int get_modifier()
int ctrl_pressed () int ctrl_pressed ()
{ {
if (dwSaved_ControlState & RIGHT_CTRL_PRESSED || return dwSaved_ControlState & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED);
dwSaved_ControlState & LEFT_CTRL_PRESSED)
return 1;
return 0;
} }
int shift_pressed ()
{
return dwSaved_ControlState & SHIFT_PRESSED;
}
int alt_pressed ()
{
return dwSaved_ControlState & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED);
}
/* void functions for UNIX copatibility */ /* void functions for UNIX copatibility */
void try_channels (int set_timeout) void try_channels (int set_timeout)
{ {

View File

@ -1,4 +1,4 @@
/* Slang interface to the Midnight Commander for Windows NT /* Slang interface to the Midnight Commander for Windows NT and OS/2
This emulates some features of ncurses on top of slang This emulates some features of ncurses on top of slang
S-lang is not fully consistent between its Unix and non-Unix versions. S-lang is not fully consistent between its Unix and non-Unix versions.
@ -19,7 +19,6 @@
#include <config.h> #include <config.h>
#include <stdio.h> #include <stdio.h>
#include <windows.h>
#include "tty.h" #include "tty.h"
#include "mad.h" #include "mad.h"
#include "color.h" #include "color.h"
@ -253,7 +252,7 @@ int got_interrupt ()
void mc_refresh (void) void mc_refresh (void)
{ {
/* if (!we_are_background) (no background mode in win32) */ /* if (!we_are_background) (no background mode yet) */
refresh (); refresh ();
} }

View File

@ -18,6 +18,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <config.h>
#include <windows.h> #include <windows.h>
#include "util.win32.h" #include "util.win32.h"
#include "util.debug.h" #include "util.debug.h"

View File

@ -17,6 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <config.h>
#include <windows.h> #include <windows.h>
#include "util.win32.h" #include "util.win32.h"
#include "util.debug.h" #include "util.debug.h"

View File

@ -17,6 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <config.h>
#ifdef HAVE_TRACE #ifdef HAVE_TRACE
#include <stdio.h> #include <stdio.h>

View File

@ -20,13 +20,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <config.h> #include <config.h>
#include <sys/types.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h>
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <windows.h> #include <windows.h>
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
@ -35,7 +31,6 @@
#include <errno.h> #include <errno.h>
#include <sys/time.h> /* select: timeout */ #include <sys/time.h> /* select: timeout */
#include <sys/param.h> #include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdarg.h> #include <stdarg.h>
#include <process.h> #include <process.h>