fixed qse_basename() for OS/2

This commit is contained in:
hyung-hwan 2011-03-17 09:17:25 +00:00
parent 287d67101a
commit b69285fc36
6 changed files with 1335 additions and 17 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: misc.c 287 2009-09-15 10:01:02Z hyunghwan.chung $
* $Id: misc.c 401 2011-03-16 15:17:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -27,7 +27,7 @@ const qse_char_t* qse_basename (const qse_char_t* path)
for (p = path; *p != QSE_T('\0'); p++)
{
if (*p == QSE_T('/')) last = p;
#ifdef _WIN32
#if defined(_WIN32) || defined(__OS2__)
else if (*p == QSE_T('\\')) last = p;
#endif
}

View File

@ -1,5 +1,5 @@
/*
* $Id: sio.c 348 2010-08-26 06:26:28Z hyunghwan.chung $
* $Id: sio.c 401 2011-03-16 15:17:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -24,8 +24,11 @@
static qse_ssize_t __sio_input (int cmd, void* arg, void* buf, qse_size_t size);
static qse_ssize_t __sio_output (int cmd, void* arg, void* buf, qse_size_t size);
#ifdef _WIN32
#include <windows.h>
#if defined(_WIN32)
# include <windows.h>
#elif defined(__OS2__)
# define INCL_DOSFILEMGR
# include <os2.h>
#endif
static qse_sio_t __sio_in =
@ -36,8 +39,10 @@ static qse_sio_t __sio_in =
{
QSE_NULL,
0,
#ifdef _WIN32
#if defined(_WIN32)
(HANDLE)STD_INPUT_HANDLE,
#elif defined(__OS2__)
(HFILE)0,
#else
0,
#endif
@ -74,6 +79,8 @@ static qse_sio_t __sio_out =
0,
#ifdef _WIN32
(HANDLE)STD_OUTPUT_HANDLE,
#elif defined(__OS2__)
(HFILE)1,
#else
1,
#endif
@ -110,6 +117,8 @@ static qse_sio_t __sio_err =
0,
#ifdef _WIN32
(HANDLE)STD_ERROR_HANDLE,
#elif defined(__OS2__)
(HFILE)2,
#else
2,
#endif
@ -288,24 +297,29 @@ int qse_sio_getpos (qse_sio_t* sio, qse_sio_pos_t* pos)
int qse_sio_setpos (qse_sio_t* sio, qse_sio_pos_t pos)
{
if (qse_sio_flush(sio) == -1) return -1;
return (qse_fio_seek (&sio->fio,
pos, QSE_FIO_BEGIN) == (qse_fio_off_t)-1)? -1: 0;
qse_fio_off_t off;
if (qse_sio_flush(sio) <= -1) return -1;
off = qse_fio_seek (&sio->fio, pos, QSE_FIO_BEGIN);
return (off == (qse_fio_off_t)-1)? -1: 0;
}
#if 0
int qse_sio_rewind (qse_sio_t* sio)
int qse_sio_seek (qse_sio_t* sio, qse_sio_seek_t pos)
{
if (qse_sio_flush(sio) == -1) return -1;
return (qse_fio_seek (&sio->fio,
0, QSE_FIO_BEGIN) == (qse_fio_off_t)-1)? -1: 0;
}
/* TODO: write this function - more flexible positioning ....
* can move to the end of the stream also.... */
int qse_sio_movetoend (qse_sio_t* sio)
{
if (qse_sio_flush(sio) == -1) return -1;
if (qse_sio_flush(sio) <= -1) return -1;
return (qse_fio_seek (&sio->fio,
0, QSE_FIO_END) == (qse_fio_off_t)-1)? -1: 0;
/* TODO: write this function */
if (qse_sio_flush(sio) <= -1) return -1;
return (qse_fio_seek (&sio->fio,
0, QSE_FIO_BEGIN) == (qse_fio_off_t)-1)? -1: 0;
}
#endif

83
qse/watcom/qse.wpj Executable file
View File

@ -0,0 +1,83 @@
40
projectIdent
0
VpeMain
1
WRect
130
560
9320
9120
2
MProject
3
MCommand
0
4
MCommand
0
3
5
WFileName
30
release/os2/lib/cmn/qsecmn.tgt
6
WFileName
30
release/os2/lib/sed/qsesed.tgt
7
WFileName
30
release/os2/cmd/sed/qsesed.tgt
8
WVList
3
9
VComponent
10
WRect
0
0
5700
4240
0
0
11
WFileName
30
release/os2/lib/cmn/qsecmn.tgt
10
14
12
VComponent
13
WRect
290
280
5700
4253
0
0
14
WFileName
30
release/os2/lib/sed/qsesed.tgt
0
0
15
VComponent
16
WRect
2100
866
5700
4253
0
0
17
WFileName
30
release/os2/cmd/sed/qsesed.tgt
0
1
15

View File

@ -0,0 +1,217 @@
40
targetIdent
0
MProject
1
MComponent
0
2
WString
4
OEXE
3
WString
5
oc2eo
1
0
1
4
MCommand
0
5
MCommand
0
6
MItem
10
qsesed.exe
7
WString
4
OEXE
8
WVList
4
9
MRState
10
WString
7
OS2LINK
11
WString
25
?????No debug information
1
1
12
MRState
13
WString
7
OS2LINK
14
WString
14
?????Debug all
1
0
15
MVState
16
WString
7
OS2LINK
17
WString
28
?????Library directories(;):
1
18
WString
27
../../lib/cmn ../../lib/sed
0
19
MVState
20
WString
7
OS2LINK
21
WString
18
?????Libraries(,):
1
22
WString
13
qsecmn qsesed
0
23
WVList
0
-1
1
1
0
24
WPickList
2
25
MItem
3
*.c
26
WString
4
COBJ
27
WVList
0
28
WVList
0
-1
1
1
0
29
MItem
28
../../../../../cmd/sed/sed.c
30
WString
4
COBJ
31
WVList
6
32
MVState
33
WString
3
WCC
34
WString
25
o?2??Include directories:
1
35
WString
54
"$(%watcom)/h;$(%watcom)/h/os2;..\..\..\..\..\include"
0
36
MVState
37
WString
3
WCC
38
WString
23
?????Macro definitions:
1
39
WString
6
NDEBUG
0
40
MRState
41
WString
3
WCC
42
WString
21
?????No optimizations
1
0
43
MRState
44
WString
3
WCC
45
WString
27
?????Average space and time
1
1
46
MRState
47
WString
3
WCC
48
WString
29
?????No debugging information
1
1
49
MRState
50
WString
3
WCC
51
WString
24
?????Full debugging info
1
0
52
WVList
0
25
1
1
0

View File

@ -0,0 +1,771 @@
40
targetIdent
0
MProject
1
MComponent
0
2
WString
3
LIB
3
WString
5
o_2so
1
0
1
4
MCommand
0
5
MCommand
0
6
MItem
10
qsecmn.lib
7
WString
3
LIB
8
WVList
0
9
WVList
0
-1
1
1
0
10
WPickList
35
11
MItem
3
*.c
12
WString
4
COBJ
13
WVList
6
14
MVState
15
WString
3
WCC
16
WString
25
o?2??Include directories:
1
17
WString
54
"$(%watcom)/h;$(%watcom)/h/os2;../../../../../include"
0
18
MVState
19
WString
3
WCC
20
WString
23
?????Macro definitions:
1
21
WString
6
NDEBUG
0
22
MRState
23
WString
3
WCC
24
WString
21
?????No optimizations
1
0
25
MRState
26
WString
3
WCC
27
WString
27
?????Average space and time
1
1
28
MRState
29
WString
3
WCC
30
WString
29
?????No debugging information
1
1
31
MRState
32
WString
3
WCC
33
WString
24
?????Full debugging info
1
0
34
WVList
0
-1
1
1
0
35
MItem
35
..\..\..\..\..\lib\cmn\alg_search.c
36
WString
4
COBJ
37
WVList
0
38
WVList
0
11
1
1
0
39
MItem
33
..\..\..\..\..\lib\cmn\alg_sort.c
40
WString
4
COBJ
41
WVList
0
42
WVList
0
11
1
1
0
43
MItem
31
..\..\..\..\..\lib\cmn\assert.c
44
WString
4
COBJ
45
WVList
0
46
WVList
0
11
1
1
0
47
MItem
28
..\..\..\..\..\lib\cmn\chr.c
48
WString
4
COBJ
49
WVList
0
50
WVList
0
11
1
1
0
51
MItem
32
..\..\..\..\..\lib\cmn\chr_cnv.c
52
WString
4
COBJ
53
WVList
0
54
WVList
0
11
1
1
0
55
MItem
28
..\..\..\..\..\lib\cmn\dll.c
56
WString
4
COBJ
57
WVList
0
58
WVList
0
11
1
1
0
59
MItem
28
..\..\..\..\..\lib\cmn\fio.c
60
WString
4
COBJ
61
WVList
0
62
WVList
0
11
1
1
0
63
MItem
28
..\..\..\..\..\lib\cmn\fma.c
64
WString
4
COBJ
65
WVList
0
66
WVList
0
11
1
1
0
67
MItem
28
..\..\..\..\..\lib\cmn\gdl.c
68
WString
4
COBJ
69
WVList
0
70
WVList
0
11
1
1
0
71
MItem
28
..\..\..\..\..\lib\cmn\htb.c
72
WString
4
COBJ
73
WVList
0
74
WVList
0
11
1
1
0
75
MItem
28
..\..\..\..\..\lib\cmn\lda.c
76
WString
4
COBJ
77
WVList
0
78
WVList
0
11
1
1
0
79
MItem
29
..\..\..\..\..\lib\cmn\main.c
80
WString
4
COBJ
81
WVList
0
82
WVList
0
11
1
1
0
83
MItem
28
..\..\..\..\..\lib\cmn\mem.c
84
WString
4
COBJ
85
WVList
0
86
WVList
0
11
1
1
0
87
MItem
29
..\..\..\..\..\lib\cmn\misc.c
88
WString
4
COBJ
89
WVList
0
90
WVList
0
11
1
1
0
91
MItem
28
..\..\..\..\..\lib\cmn\oht.c
92
WString
4
COBJ
93
WVList
0
94
WVList
0
11
1
1
0
95
MItem
28
..\..\..\..\..\lib\cmn\opt.c
96
WString
4
COBJ
97
WVList
0
98
WVList
0
11
1
1
0
99
MItem
28
..\..\..\..\..\lib\cmn\pio.c
100
WString
4
COBJ
101
WVList
0
102
WVList
0
11
1
1
0
103
MItem
28
..\..\..\..\..\lib\cmn\rbt.c
104
WString
4
COBJ
105
WVList
0
106
WVList
0
11
1
1
0
107
MItem
28
..\..\..\..\..\lib\cmn\rex.c
108
WString
4
COBJ
109
WVList
0
110
WVList
0
11
1
1
0
111
MItem
28
..\..\..\..\..\lib\cmn\sio.c
112
WString
4
COBJ
113
WVList
0
114
WVList
0
11
1
1
0
115
MItem
28
..\..\..\..\..\lib\cmn\sll.c
116
WString
4
COBJ
117
WVList
0
118
WVList
0
11
1
1
0
119
MItem
30
..\..\..\..\..\lib\cmn\stdio.c
120
WString
4
COBJ
121
WVList
0
122
WVList
0
11
1
1
0
123
MItem
32
..\..\..\..\..\lib\cmn\str_bas.c
124
WString
4
COBJ
125
WVList
0
126
WVList
0
11
1
1
0
127
MItem
32
..\..\..\..\..\lib\cmn\str_cnv.c
128
WString
4
COBJ
129
WVList
0
130
WVList
0
11
1
1
0
131
MItem
32
..\..\..\..\..\lib\cmn\str_dyn.c
132
WString
4
COBJ
133
WVList
0
134
WVList
0
11
1
1
0
135
MItem
32
..\..\..\..\..\lib\cmn\str_utl.c
136
WString
4
COBJ
137
WVList
1
138
MVState
139
WString
3
WCC
140
WString
25
o?2??Include directories:
1
141
WString
54
"$(%watcom)/h;$(%watcom)/h/os2;..\..\..\..\..\include"
0
142
WVList
0
11
1
1
0
143
MItem
29
..\..\..\..\..\lib\cmn\time.c
144
WString
4
COBJ
145
WVList
0
146
WVList
0
11
1
1
0
147
MItem
28
..\..\..\..\..\lib\cmn\tio.c
148
WString
4
COBJ
149
WVList
0
150
WVList
0
11
1
1
0
151
MItem
32
..\..\..\..\..\lib\cmn\tio_get.c
152
WString
4
COBJ
153
WVList
0
154
WVList
0
11
1
1
0
155
MItem
32
..\..\..\..\..\lib\cmn\tio_put.c
156
WString
4
COBJ
157
WVList
0
158
WVList
0
11
1
1
0
159
MItem
28
..\..\..\..\..\lib\cmn\xma.c
160
WString
4
COBJ
161
WVList
0
162
WVList
0
11
1
1
0
163
MItem
3
*.h
164
WString
3
NIL
165
WVList
0
166
WVList
0
-1
1
1
0
167
MItem
28
..\..\..\..\..\lib\cmn\mem.h
168
WString
3
NIL
169
WVList
0
170
WVList
0
163
1
1
0
171
MItem
32
..\..\..\..\..\lib\cmn\syscall.h
172
WString
3
NIL
173
WVList
0
174
WVList
0
163
1
1
0

View File

@ -0,0 +1,233 @@
40
targetIdent
0
MProject
1
MComponent
0
2
WString
3
LIB
3
WString
5
o_2so
1
0
1
4
MCommand
0
5
MCommand
0
6
MItem
10
qsesed.lib
7
WString
3
LIB
8
WVList
0
9
WVList
0
-1
1
1
0
10
WPickList
6
11
MItem
3
*.c
12
WString
4
COBJ
13
WVList
6
14
MVState
15
WString
3
WCC
16
WString
25
o?2??Include directories:
1
17
WString
54
"$(%watcom)/h;$(%watcom)/h/os2;..\..\..\..\..\include"
0
18
MVState
19
WString
3
WCC
20
WString
23
?????Macro definitions:
1
21
WString
6
NDEBUG
0
22
MRState
23
WString
3
WCC
24
WString
21
?????No optimizations
1
0
25
MRState
26
WString
3
WCC
27
WString
27
?????Average space and time
1
1
28
MRState
29
WString
3
WCC
30
WString
29
?????No debugging information
1
1
31
MRState
32
WString
3
WCC
33
WString
24
?????Full debugging info
1
0
34
WVList
0
-1
1
1
0
35
MItem
28
../../../../../lib/sed/err.c
36
WString
4
COBJ
37
WVList
0
38
WVList
0
11
1
1
0
39
MItem
28
../../../../../lib/sed/sed.c
40
WString
4
COBJ
41
WVList
0
42
WVList
0
11
1
1
0
43
MItem
28
../../../../../lib/sed/std.c
44
WString
4
COBJ
45
WVList
0
46
WVList
0
11
1
1
0
47
MItem
3
*.h
48
WString
3
NIL
49
WVList
0
50
WVList
0
-1
1
1
0
51
MItem
28
../../../../../lib/sed/sed.h
52
WString
3
NIL
53
WVList
0
54
WVList
0
47
1
1
0