added some DOS stuffs

This commit is contained in:
hyung-hwan 2011-05-04 08:00:38 +00:00
parent fd0b3f9abd
commit 574f373cf0
11 changed files with 222 additions and 67 deletions

View File

@ -2,7 +2,9 @@ SUBDIRS = cmn awk cut sed scm http
pkgincludedir = $(includedir)/qse pkgincludedir = $(includedir)/qse
pkginclude_HEADERS = conf_msw.h conf_vms.h types.h macros.h pack1.h unpack.h pkginclude_HEADERS = \
conf_msw.h conf_os2.h conf_dos.h conf_vms.h \
types.h macros.h pack1.h unpack.h
if ENABLE_CXX if ENABLE_CXX
pkginclude_HEADERS += Types.hpp pkginclude_HEADERS += Types.hpp

View File

@ -57,8 +57,9 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
install-pdf-recursive install-ps-recursive install-recursive \ install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive ps-recursive uninstall-recursive
am__pkginclude_HEADERS_DIST = conf_msw.h conf_vms.h types.h macros.h \ am__pkginclude_HEADERS_DIST = \
pack1.h unpack.h Types.hpp conf_msw.h conf_os2.h conf_dos.h conf_vms.h \
types.h macros.h pack1.h unpack.h Types.hpp
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \ am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@ -255,8 +256,9 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
SUBDIRS = cmn awk cut sed scm http SUBDIRS = cmn awk cut sed scm http
pkginclude_HEADERS = conf_msw.h conf_vms.h types.h macros.h pack1.h \ pkginclude_HEADERS = \
unpack.h $(am__append_1) conf_msw.h conf_os2.h conf_dos.h conf_vms.h \
types.h macros.h pack1.h unpack.h $(am__append_1)
all: config.h all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive $(MAKE) $(AM_MAKEFLAGS) all-recursive

View File

@ -0,0 +1,82 @@
/*
* $Id$
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
QSE is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
QSE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
*/
/* DOS for other platforms than x86?
* If so, the endian should be defined selectively
*/
#define QSE_ENDIAN_LITTLE
/*
* You must define which character type to use as a default character here.
*
* #define QSE_CHAR_IS_WCHAR
* #define QSE_CHAR_IS_MCHAR
*/
#if defined(__WATCOMC__) && defined(__386__)
# define QSE_SIZEOF_CHAR 1
# define QSE_SIZEOF_SHORT 2
# define QSE_SIZEOF_INT 4
# define QSE_SIZEOF_LONG 4
# define QSE_SIZEOF_LONG_LONG 8
#
# define QSE_SIZEOF_VOID_P 4
# define QSE_SIZEOF_FLOAT 4
# define QSE_SIZEOF_DOUBLE 8
# define QSE_SIZEOF_LONG_DOUBLE 8
# define QSE_SIZEOF_WCHAR_T 2
#
# define QSE_SIZEOF___INT8 1
# define QSE_SIZEOF___INT16 2
# define QSE_SIZEOF___INT32 4
# define QSE_SIZEOF___INT64 8
# define QSE_SIZEOF___INT128 0
#
# define QSE_SIZEOF_OFF64_T 0
# define QSE_SIZEOF_OFF_T 4
#
# define QSE_CHAR_IS_WCHAR
#elif defined(__WATCOMC__) && !defined(__386__)
# define QSE_SIZEOF_CHAR 1
# define QSE_SIZEOF_SHORT 2
# define QSE_SIZEOF_INT 2
# define QSE_SIZEOF_LONG 4
# define QSE_SIZEOF_LONG_LONG 8
#
# define QSE_SIZEOF_VOID_P 4
# define QSE_SIZEOF_FLOAT 4
# define QSE_SIZEOF_DOUBLE 8
# define QSE_SIZEOF_LONG_DOUBLE 8
# define QSE_SIZEOF_WCHAR_T 2
#
# define QSE_SIZEOF___INT8 1
# define QSE_SIZEOF___INT16 2
# define QSE_SIZEOF___INT32 4
# define QSE_SIZEOF___INT64 8
# define QSE_SIZEOF___INT128 0
#
# define QSE_SIZEOF_OFF64_T 0
# define QSE_SIZEOF_OFF_T 4
#
# define QSE_CHAR_IS_WCHAR
#else
# error Define the size of various data types.
#endif

View File

@ -1,5 +1,5 @@
/* /*
* $Id: conf_msw.h 287 2009-09-15 10:01:02Z hyunghwan.chung $ * $Id$
* *
Copyright 2006-2011 Chung, Hyung-Hwan. Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE. This file is part of QSE.

View File

@ -1,5 +1,5 @@
/* /*
* $Id: types.h 450 2011-05-03 07:48:42Z hyunghwan.chung $ * $Id: types.h 451 2011-05-03 14:00:38Z hyunghwan.chung $
* *
Copyright 2006-2011 Chung, Hyung-Hwan. Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE. This file is part of QSE.
@ -36,6 +36,8 @@
# include <qse/conf_msw.h> # include <qse/conf_msw.h>
#elif defined(__OS2__) #elif defined(__OS2__)
# include <qse/conf_os2.h> # include <qse/conf_os2.h>
#elif defined(__DOS__)
# include <qse/conf_dos.h>
#elif defined(vms) || defined(__vms) #elif defined(vms) || defined(__vms)
# include <qse/conf_vms.h> # include <qse/conf_vms.h>
#else #else

View File

@ -1,5 +1,5 @@
/* /*
* $Id: std.c 447 2011-05-01 13:28:51Z hyunghwan.chung $ * $Id: std.c 451 2011-05-03 14:00:38Z hyunghwan.chung $
* *
Copyright 2006-2011 Chung, Hyung-Hwan. Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE. This file is part of QSE.
@ -37,7 +37,7 @@
#endif #endif
#ifndef QSE_HAVE_CONFIG_H #ifndef QSE_HAVE_CONFIG_H
# if defined(__OS2__) || defined(_WIN32) || defined(__DOS__) # if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
# define HAVE_POW # define HAVE_POW
# define HAVE_SIN # define HAVE_SIN
# define HAVE_COS # define HAVE_COS

View File

@ -36,6 +36,9 @@
#elif defined(__OS2__) #elif defined(__OS2__)
# define INCL_DOSPROCESS # define INCL_DOSPROCESS
# include <os2.h> # include <os2.h>
#elif defined(__DOS__)
# include <dos.h>
# include <dosfunc.h>
#else #else
# include "syscall.h" # include "syscall.h"
#endif #endif
@ -86,9 +89,11 @@ void qse_assert_failed (
void *btarray[128]; void *btarray[128];
qse_size_t btsize, i; qse_size_t btsize, i;
char **btsyms; char **btsyms;
#ifdef QSE_CHAR_IS_WCHAR #ifdef QSE_CHAR_IS_WCHAR
qse_wchar_t wcs[256]; qse_wchar_t wcs[256];
#endif #endif
#endif #endif
qse_sio_puts (QSE_SIO_ERR, QSE_T("=[ASSERTION FAILURE]============================================================\n")); qse_sio_puts (QSE_SIO_ERR, QSE_T("=[ASSERTION FAILURE]============================================================\n"));
@ -151,9 +156,16 @@ void qse_assert_failed (
qse_sio_flush (QSE_SIO_ERR); qse_sio_flush (QSE_SIO_ERR);
#if defined(_WIN32) #if defined(_WIN32)
ExitProcess (1); ExitProcess (249);
#elif defined(__OS2__) #elif defined(__OS2__)
DosExit (EXIT_PROCESS, 1); DosExit (EXIT_PROCESS, 249);
#elif defined(__DOS__)
{
union REGS regs;
regs.h.ah = DOS_EXIT;
regs.h.al = 249;
intdos (&regs, &regs);
}
#else #else
QSE_KILL (QSE_GETPID(), SIGABRT); QSE_KILL (QSE_GETPID(), SIGABRT);
QSE_EXIT (1); QSE_EXIT (1);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: chr_cnv.c 441 2011-04-22 14:28:43Z hyunghwan.chung $ * $Id: chr_cnv.c 451 2011-05-03 14:00:38Z hyunghwan.chung $
* *
Copyright 2006-2011 Chung, Hyung-Hwan. Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE. This file is part of QSE.
@ -22,7 +22,7 @@
#include "mem.h" #include "mem.h"
#if !defined(QSE_HAVE_CONFIG_H) #if !defined(QSE_HAVE_CONFIG_H)
# if defined(_WIN32) || defined(__OS2__) # if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
# define HAVE_WCHAR_H # define HAVE_WCHAR_H
# define HAVE_STDLIB_H # define HAVE_STDLIB_H
# define HAVE_MBRLEN # define HAVE_MBRLEN

View File

@ -1,5 +1,5 @@
/* /*
* $Id: fio.c 441 2011-04-22 14:28:43Z hyunghwan.chung $ * $Id: fio.c 451 2011-05-03 14:00:38Z hyunghwan.chung $
* *
Copyright 2006-2011 Chung, Hyung-Hwan. Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE. This file is part of QSE.
@ -252,6 +252,9 @@ qse_fio_t* qse_fio_init (
if (ret != NO_ERROR) return QSE_NULL; if (ret != NO_ERROR) return QSE_NULL;
} }
#elif defined(__DOS__)
/* UNSUPPORTED */
return QSE_NULL;
#else #else
if (flags & QSE_FIO_HANDLE) if (flags & QSE_FIO_HANDLE)
@ -328,6 +331,9 @@ qse_fio_t* qse_fio_init (
CloseHandle (handle); CloseHandle (handle);
#elif defined(__OS2__) #elif defined(__OS2__)
DosClose (handle); DosClose (handle);
#elif defined(__DOS__)
/* UNSUPPORTED */
;
#else #else
QSE_CLOSE (handle); QSE_CLOSE (handle);
#endif #endif
@ -349,6 +355,9 @@ void qse_fio_fini (qse_fio_t* fio)
CloseHandle (fio->handle); CloseHandle (fio->handle);
#elif defined(__OS2__) #elif defined(__OS2__)
DosClose (fio->handle); DosClose (fio->handle);
#elif defined(__DOS__)
/* UNSUPPORTED */
;
#else #else
QSE_CLOSE (fio->handle); QSE_CLOSE (fio->handle);
#endif #endif
@ -417,6 +426,11 @@ qse_fio_off_t qse_fio_seek (
if (ret != NO_ERROR) return (qse_fio_off_t)-1; if (ret != NO_ERROR) return (qse_fio_off_t)-1;
return ((qse_fio_off_t)pos.ulHi << 32) | pos.ulLo; return ((qse_fio_off_t)pos.ulHi << 32) | pos.ulLo;
#elif defined(__DOS__)
/* UNSUPPORTED */
return -1;
#else #else
static int seek_map[] = static int seek_map[] =
{ {
@ -468,6 +482,11 @@ int qse_fio_truncate (qse_fio_t* fio, qse_fio_off_t size)
ret = DosSetFileSizeL (fio->handle, sz); ret = DosSetFileSizeL (fio->handle, sz);
return (ret == NO_ERROR)? 0: -1; return (ret == NO_ERROR)? 0: -1;
#elif defined(__DOS__)
/* UNSUPPORTED */
return -1;
#else #else
return QSE_FTRUNCATE (fio->handle, size); return QSE_FTRUNCATE (fio->handle, size);
#endif #endif
@ -485,6 +504,10 @@ static qse_ssize_t fio_read (qse_fio_t* fio, void* buf, qse_size_t size)
if (size > QSE_TYPE_MAX(ULONG)) size = QSE_TYPE_MAX(ULONG); if (size > QSE_TYPE_MAX(ULONG)) size = QSE_TYPE_MAX(ULONG);
if (DosRead (fio->handle, buf, (ULONG)size, &count) != NO_ERROR) return -1; if (DosRead (fio->handle, buf, (ULONG)size, &count) != NO_ERROR) return -1;
return (qse_ssize_t)count; return (qse_ssize_t)count;
#elif defined(__DOS__)
/* UNSUPPORTED */
return -1;
#else #else
if (size > QSE_TYPE_MAX(size_t)) size = QSE_TYPE_MAX(size_t); if (size > QSE_TYPE_MAX(size_t)) size = QSE_TYPE_MAX(size_t);
return QSE_READ (fio->handle, buf, size); return QSE_READ (fio->handle, buf, size);
@ -511,6 +534,10 @@ static qse_ssize_t fio_write (qse_fio_t* fio, const void* data, qse_size_t size)
if (size > QSE_TYPE_MAX(ULONG)) size = QSE_TYPE_MAX(ULONG); if (size > QSE_TYPE_MAX(ULONG)) size = QSE_TYPE_MAX(ULONG);
if (DosWrite(fio->handle, (PVOID)data, (ULONG)size, &count) != NO_ERROR) return -1; if (DosWrite(fio->handle, (PVOID)data, (ULONG)size, &count) != NO_ERROR) return -1;
return (qse_ssize_t)count; return (qse_ssize_t)count;
#elif defined(__DOS__)
/* UNSUPPORTED */
return -1;
#else #else
if (size > QSE_TYPE_MAX(size_t)) size = QSE_TYPE_MAX(size_t); if (size > QSE_TYPE_MAX(size_t)) size = QSE_TYPE_MAX(size_t);
return QSE_WRITE (fio->handle, data, size); return QSE_WRITE (fio->handle, data, size);
@ -662,6 +689,10 @@ int qse_fio_chmod (qse_fio_t* fio, int mode)
stat.attrFile = flags; stat.attrFile = flags;
return (DosSetFileInfo (fio->handle, FIL_STANDARDL, &stat, size) != NO_ERROR)? -1: 0; return (DosSetFileInfo (fio->handle, FIL_STANDARDL, &stat, size) != NO_ERROR)? -1: 0;
#elif defined(__DOS__)
/* UNSUPPORTED */
return -1;
#else #else
return QSE_FCHMOD (fio->handle, mode); return QSE_FCHMOD (fio->handle, mode);
#endif #endif
@ -673,6 +704,10 @@ int qse_fio_sync (qse_fio_t* fio)
return (FlushFileBuffers (fio->handle) == FALSE)? -1: 0; return (FlushFileBuffers (fio->handle) == FALSE)? -1: 0;
#elif defined(__OS2__) #elif defined(__OS2__)
return (DosResetBuffer (fio->handle) == NO_ERROR)? 0: -1; return (DosResetBuffer (fio->handle) == NO_ERROR)? 0: -1;
#elif defined(__DOS__)
/* UNSUPPORTED */
return -1;
#else #else
return QSE_FSYNC (fio->handle); return QSE_FSYNC (fio->handle);
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
* $Id: misc.c 450 2011-05-03 07:48:42Z hyunghwan.chung $ * $Id: misc.c 451 2011-05-03 14:00:38Z hyunghwan.chung $
* *
Copyright 2006-2011 Chung, Hyung-Hwan. Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE. This file is part of QSE.
@ -28,7 +28,7 @@ const qse_mchar_t* qse_mbsbasename (const qse_mchar_t* path)
for (p = path; *p != QSE_MT('\0'); p++) for (p = path; *p != QSE_MT('\0'); p++)
{ {
if (*p == QSE_MT('/')) last = p; if (*p == QSE_MT('/')) last = p;
#if defined(__OS2__) || defined(_WIN32) || defined(__DOS__) #if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
else if (*p == QSE_MT('\\')) last = p; else if (*p == QSE_MT('\\')) last = p;
#endif #endif
} }
@ -43,7 +43,7 @@ const qse_wchar_t* qse_wcsbasename (const qse_wchar_t* path)
for (p = path; *p != QSE_WT('\0'); p++) for (p = path; *p != QSE_WT('\0'); p++)
{ {
if (*p == QSE_WT('/')) last = p; if (*p == QSE_WT('/')) last = p;
#if defined(__OS2__) || defined(_WIN32) || defined(__DOS__) #if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
else if (*p == QSE_WT('\\')) last = p; else if (*p == QSE_WT('\\')) last = p;
#endif #endif
} }

View File

@ -16,7 +16,7 @@ MCommand
4 4
MCommand MCommand
0 0
14 15
5 5
WFileName WFileName
30 30
@ -74,11 +74,15 @@ WFileName
28 28
debug/os2/cmd/awk/qseawk.tgt debug/os2/cmd/awk/qseawk.tgt
19 19
WVList WFileName
14 30
debug/dos32/lib/cmn/qsecmn.tgt
20 20
VComponent WVList
15
21 21
VComponent
22
WRect WRect
410 410
1880 1880
@ -86,15 +90,15 @@ WRect
4240 4240
1 1
0 0
22 23
WFileName WFileName
30 30
release/os2/lib/cmn/qsecmn.tgt release/os2/lib/cmn/qsecmn.tgt
28 28
29 29
23
VComponent
24 24
VComponent
25
WRect WRect
90 90
1240 1240
@ -102,15 +106,15 @@ WRect
4240 4240
1 1
0 0
25 26
WFileName WFileName
30 30
release/os2/lib/sed/qsesed.tgt release/os2/lib/sed/qsesed.tgt
0 0
0 0
26
VComponent
27 27
VComponent
28
WRect WRect
2100 2100
1400 1400
@ -118,15 +122,15 @@ WRect
4240 4240
1 1
0 0
28 29
WFileName WFileName
30 30
release/os2/cmd/sed/qsesed.tgt release/os2/cmd/sed/qsesed.tgt
0 0
1 1
29
VComponent
30 30
VComponent
31
WRect WRect
590 590
1080 1080
@ -134,31 +138,31 @@ WRect
4240 4240
1 1
0 0
31 32
WFileName WFileName
30 30
release/os2/lib/scm/qsescm.tgt release/os2/lib/scm/qsescm.tgt
0 0
0 0
32
VComponent
33 33
VComponent
34
WRect WRect
380 3100
0 1440
5700 5700
4240 4240
1
0 0
34 0
35
WFileName WFileName
28 28
debug/os2/lib/cmn/qsecmn.tgt debug/os2/lib/cmn/qsecmn.tgt
29 0
32 0
35
VComponent
36 36
VComponent
37
WRect WRect
1050 1050
2360 2360
@ -166,15 +170,15 @@ WRect
4240 4240
1 1
0 0
37 38
WFileName WFileName
28 28
debug/os2/lib/sed/qsesed.tgt debug/os2/lib/sed/qsesed.tgt
0 0
5 5
38
VComponent
39 39
VComponent
40
WRect WRect
2360 2360
1280 1280
@ -182,15 +186,15 @@ WRect
4240 4240
1 1
0 0
40 41
WFileName WFileName
28 28
debug/os2/lib/scm/qsescm.tgt debug/os2/lib/scm/qsescm.tgt
0 0
0 0
41
VComponent
42 42
VComponent
43
WRect WRect
2460 2460
2400 2400
@ -198,15 +202,15 @@ WRect
4240 4240
1 1
0 0
43 44
WFileName WFileName
28 28
debug/os2/cmd/scm/qsescm.tgt debug/os2/cmd/scm/qsescm.tgt
0 0
1 1
44
VComponent
45 45
VComponent
46
WRect WRect
980 980
1080 1080
@ -214,15 +218,15 @@ WRect
4240 4240
1 1
0 0
46 47
WFileName WFileName
30 30
debug/win32/lib/cmn/qsecmn.tgt debug/win32/lib/cmn/qsecmn.tgt
29 29
30 30
47
VComponent
48 48
VComponent
49
WRect WRect
200 200
1240 1240
@ -230,15 +234,15 @@ WRect
4240 4240
1 1
0 0
49 50
WFileName WFileName
30 30
debug/win32/lib/scm/qsescm.tgt debug/win32/lib/scm/qsescm.tgt
0 0
0 0
50
VComponent
51 51
VComponent
52
WRect WRect
3280 3280
40 40
@ -246,15 +250,15 @@ WRect
4240 4240
1 1
0 0
52 53
WFileName WFileName
30 30
debug/win32/cmd/scm/qsescm.tgt debug/win32/cmd/scm/qsescm.tgt
0 0
0 0
53
VComponent
54 54
VComponent
55
WRect WRect
240 240
80 80
@ -262,15 +266,15 @@ WRect
4240 4240
0 0
0 0
55 56
WFileName WFileName
28 28
debug/os2/lib/awk/qseawk.tgt debug/os2/lib/awk/qseawk.tgt
8 8
12 12
56
VComponent
57 57
VComponent
58
WRect WRect
830 830
2720 2720
@ -278,15 +282,15 @@ WRect
4240 4240
1 1
0 0
58 59
WFileName WFileName
30 30
debug/win32/lib/awk/qseawk.tgt debug/win32/lib/awk/qseawk.tgt
8 8
9 9
59
VComponent
60 60
VComponent
61
WRect WRect
2920 2920
880 880
@ -294,10 +298,26 @@ WRect
4240 4240
0 0
0 0
61 62
WFileName WFileName
28 28
debug/os2/cmd/awk/qseawk.tgt debug/os2/cmd/awk/qseawk.tgt
0 0
1 1
59 63
VComponent
64
WRect
430
2480
5700
4240
0
0
65
WFileName
30
debug/dos32/lib/cmn/qsecmn.tgt
0
3
63