mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Better support for MinGW. Updates in slint_pc.c for syntax highlighting.
This commit is contained in:
parent
4feaae8ed4
commit
e161b6d92c
11
pc/ChangeLog
11
pc/ChangeLog
@ -1,3 +1,14 @@
|
||||
Fri May 8 10:49:21 1998 Pavel Roskin <pavel.roskin@ecsoft.co.uk>
|
||||
|
||||
* Makefile.PC, Makefile.MIN: support for custom extension
|
||||
for compiled resourses
|
||||
|
||||
* key_nt.c: Minor changes for MinGW
|
||||
|
||||
* mc.rc: WindRes support
|
||||
|
||||
* slint_pc.c: support for syntax highlighting
|
||||
|
||||
Fri May 1 17:33:11 1998 Pavel Roskin <pavel.roskin@ecsoft.co.uk>
|
||||
|
||||
* chmod.c: Updated call to update_panels()
|
||||
|
@ -14,7 +14,7 @@ FILES = BUGS Makefile Makefile.BC2 Makefile.BC5 Makefile.EMX Makefile.MIN \
|
||||
config.h cons_nt.c cons_os2.c dirent.h dirent_nt.c dirent_os2.c \
|
||||
drive.c drive.h key_nt.c key_os2.c mc.def mc.rc mc_nt.ico \
|
||||
mc_os2.ico slint_pc.c trace_nt.c trace_nt.h util_nt.c \
|
||||
util_os2.c util_win32.c util_win32.h util_winnt.c
|
||||
util_os2.c util_win32.c util_win32.h util_winnt.c ChangeLog
|
||||
|
||||
FILESSYS = sys/param.h sys/time.h
|
||||
|
||||
|
@ -18,6 +18,7 @@ EXE_PLACE=-o
|
||||
# Just comment RSC out if you have problems with resources
|
||||
RSC=windres.exe
|
||||
RES_PLACE=-o
|
||||
RES_SUFFIX=o
|
||||
|
||||
# ---- Compiler-specific optional stuff
|
||||
MC_MISC_CFLAGS=
|
||||
@ -31,7 +32,7 @@ SPECIFIC_MC_CFLAGS=-g -O0 $(MC_MISC_CFLAGS)
|
||||
SPECIFIC_MC_LFLAGS_EXTRA=
|
||||
SPECIFIC_SLANG_CFLAGS=$(SPECIFIC_MC_CFLAGS)
|
||||
SPECIFIC_MCEDIT_CFLAGS=$(SPECIFIC_MC_CFLAGS)
|
||||
RC_DEFINES=-O coff --define _DEBUG
|
||||
RC_DEFINES=--define WINDRES --define _DEBUG
|
||||
else
|
||||
# ---- Release build
|
||||
OBJS_DIR=release
|
||||
@ -41,7 +42,7 @@ SPECIFIC_MC_CFLAGS=-O2 $(MC_MISC_CFLAGS)
|
||||
SPECIFIC_MC_LFLAGS_EXTRA=
|
||||
SPECIFIC_SLANG_CFLAGS=$(SPECIFIC_MC_CFLAGS)
|
||||
SPECIFIC_MCEDIT_CFLAGS=$(SPECIFIC_MC_CFLAGS)
|
||||
RC_DEFINES=-O coff --define RELEASE=$(RELEASE)
|
||||
RC_DEFINES=--define WINDRES --define RELEASE=$(RELEASE)
|
||||
endif
|
||||
|
||||
# ---- Compiler independent defines
|
||||
|
@ -42,8 +42,6 @@ MCEDIT_INCLUDES=-I$(MC_PC_DIR) -I$(MC_SRC_DIR)/.. -I$(SLANG_SRC_DIR)
|
||||
CFLAGS=$(SPECIFIC_MC_CFLAGS) $(MC_INCLUDES) $(MC_DEFINES) -c
|
||||
SLANG_CFLAGS=$(SPECIFIC_SLANG_CFLAGS) $(SLANG_INCLUDES) $(SLANG_DEFINES) -c
|
||||
MCEDIT_CFLAGS=$(SPECIFIC_MCEDIT_CFLAGS) $(MCEDIT_INCLUDES) $(MCEDIT_DEFINES) -c
|
||||
RSC_FLAGS=$(RES_PLACE)$(OBJS_DIR)/mc.res $(RC_DEFINES)
|
||||
|
||||
|
||||
|
||||
all: object-dirs mc
|
||||
@ -163,10 +161,16 @@ MCEDIT_OBJS=$(addprefix $(MCEDIT_OBJS_DIR)/, \
|
||||
$(patsubst %.c,%.$(OBJ_SUFFIX),$(MCEDIT_SRCS)))
|
||||
|
||||
ifdef RSC
|
||||
MC_RES=$(OBJS_DIR)/mc.res
|
||||
|
||||
ifndef RES_SUFFIX
|
||||
RES_SUFFIX=res
|
||||
endif # RES_SUFFIX
|
||||
|
||||
MC_RES=$(OBJS_DIR)/mc.$(RES_SUFFIX)
|
||||
|
||||
$(MC_RES): $(MC_PC_DIR)/mc.rc $(MC_PC_DIR)/mc_nt.ico $(MC_PC_DIR)/config.h ../VERSION
|
||||
$(RSC) $(RES_PLACE)$(MC_RES) $(RC_DEFINES) $(MC_PC_DIR)/mc.rc
|
||||
|
||||
else
|
||||
MC_RES=
|
||||
endif
|
||||
|
||||
$(OBJS_DIR)/mc.res: $(MC_PC_DIR)/mc.rc $(MC_PC_DIR)/mc_nt.ico $(MC_PC_DIR)/config.h ../VERSION
|
||||
$(RSC) $(RSC_FLAGS) $(MC_PC_DIR)/mc.rc
|
||||
endif # !RSC
|
||||
|
@ -176,7 +176,11 @@ int get_key_code (int no_delay)
|
||||
break;
|
||||
|
||||
vkcode = ir.Event.KeyEvent.wVirtualKeyCode;
|
||||
#ifndef __MINGW32__
|
||||
ch = ir.Event.KeyEvent.uChar.AsciiChar;
|
||||
#else
|
||||
ch = ir.Event.KeyEvent.AsciiChar;
|
||||
#endif
|
||||
dwSaved_ControlState = ir.Event.KeyEvent.dwControlKeyState;
|
||||
j = translate_key_code (ch, vkcode);
|
||||
if (j)
|
||||
|
8
pc/mc.rc
8
pc/mc.rc
@ -1,15 +1,19 @@
|
||||
|
||||
#ifdef WINDRES
|
||||
# include "../VERSION"
|
||||
#else
|
||||
# include "windows.h"
|
||||
# include "winver.h"
|
||||
# include "config.h"
|
||||
|
||||
#endif
|
||||
|
||||
/* English (U.S.) resources */
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef WINDRES
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#endif
|
||||
#pragma code_page(1252)
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
@ -139,12 +139,6 @@ void vline (int character, int len)
|
||||
}
|
||||
}
|
||||
|
||||
void init_pair (int index, char *foreground, char *background)
|
||||
{
|
||||
SLtt_set_color (index, "", foreground, background);
|
||||
}
|
||||
|
||||
|
||||
int has_colors ()
|
||||
{
|
||||
/* No terminals on NT, make default color */
|
||||
@ -218,3 +212,55 @@ void slang_set_raw_mode (void)
|
||||
return;
|
||||
}
|
||||
|
||||
int max_index = 0;
|
||||
|
||||
void
|
||||
init_pair (int index, char *foreground, char *background)
|
||||
{
|
||||
|
||||
SLtt_set_color (index, "", foreground, background);
|
||||
if (index > max_index)
|
||||
max_index = index;
|
||||
}
|
||||
|
||||
int
|
||||
alloc_color_pair (char *foreground, char *background)
|
||||
{
|
||||
init_pair (++max_index, foreground, background);
|
||||
return max_index;
|
||||
}
|
||||
|
||||
int
|
||||
try_alloc_color_pair (char *fg, char *bg)
|
||||
{
|
||||
static struct colors_avail {
|
||||
struct colors_avail *next;
|
||||
char *fg, *bg;
|
||||
int index;
|
||||
} *p, c =
|
||||
{
|
||||
0, 0, 0, 0
|
||||
};
|
||||
|
||||
c.index = NORMAL_COLOR;
|
||||
p = &c;
|
||||
for (;;) {
|
||||
if (((fg && p->fg) ? !strcmp (fg, p->fg) : fg == p->fg) != 0
|
||||
&& ((bg && p->bg) ? !strcmp (bg, p->bg) : bg == p->bg) != 0)
|
||||
return p->index;
|
||||
if (!p->next)
|
||||
break;
|
||||
p = p->next;
|
||||
}
|
||||
p->next = malloc (sizeof (c));
|
||||
p = p->next;
|
||||
p->next = 0;
|
||||
p->fg = fg ? strdup (fg) : 0;
|
||||
p->bg = bg ? strdup (bg) : 0;
|
||||
if (!fg)
|
||||
fg = "white";
|
||||
if (!bg)
|
||||
bg = "blue";
|
||||
p->index = alloc_color_pair (fg, bg);
|
||||
return p->index;
|
||||
}
|
||||
|
@ -96,6 +96,8 @@ int win32_GetVersionEx ()
|
||||
|
||||
int win32_GetEXEType (const char* a_szFileName)
|
||||
{
|
||||
/* FIXME: MinGW cannot compile this code */
|
||||
#ifndef __MINGW32__
|
||||
HANDLE hImage;
|
||||
DWORD dwDumm;
|
||||
DWORD SectionOffset;
|
||||
@ -177,6 +179,9 @@ int win32_GetEXEType (const char* a_szFileName)
|
||||
win32Trace(("Unknown type %u.\n", image_optional_header.Subsystem));
|
||||
return EXE_Unknown;
|
||||
}
|
||||
#else
|
||||
return EXE_Unknown;
|
||||
#endif /* !__MINGW32__ */
|
||||
}
|
||||
|
||||
|
||||
|
@ -203,7 +203,11 @@ unsigned int SLsys_getkey (void)
|
||||
return 0;
|
||||
}
|
||||
if (record.EventType == KEY_EVENT && record.Event.KeyEvent.bKeyDown) {
|
||||
#ifndef __MINGW32__
|
||||
return record.Event.KeyEvent.uChar.AsciiChar;
|
||||
#else
|
||||
return record.Event.KeyEvent.AsciiChar;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/* ReadFile(hStdin, &key, 1, &bytesRead, NULL); */
|
||||
|
Loading…
Reference in New Issue
Block a user