source: GPL/branches/uniaud32-2.1.x/drv32/util.cpp@ 546

Last change on this file since 546 was 461, checked in by Paul Smedley, 16 years ago

Bump uniaud.inc

File size: 5.6 KB
Line 
1/* $Id: util.cpp,v 1.1.1.1 2003/07/02 13:56:56 eleph Exp $ */
2/*
3 * Replacement runtime routines for Watcom C++
4 *
5 * (C) 2000-2002 InnoTek Systemberatung GmbH
6 * (C) 2000-2001 Sander van Leeuwen (sandervl@xs4all.nl)
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
21 * USA.
22 *
23 */
24#define INCL_NOPMAPI
25#define INCL_DOSINFOSEG
26#include <os2.h>
27
28#include <devhelp.h>
29#include <devinfo.h>
30
31#include <malloc.h>
32#include <include.h>
33#include <irqos2.h>
34
35//*****************************************************************************
36//*****************************************************************************
37extern "C" void __wcpp_2_undefed_cdtor_(void)
38{
39 int3();
40}
41//*****************************************************************************
42//*****************************************************************************
43extern "C" void __wcpp_2_undefined_member_function_(void)
44{
45 int3();
46}
47//*****************************************************************************
48//*****************************************************************************
49extern "C" void __wcpp_2_pure_error_(void)
50{
51 int3();
52}
53//*****************************************************************************
54//*****************************************************************************
55extern "C" void __wcpp_2_undef_vfun_(void)
56{
57 int3();
58}
59//*****************************************************************************
60//*****************************************************************************
61extern "C" void __wcpp_4_undefed_cdtor_(void)
62{
63 int3();
64}
65//*****************************************************************************
66//*****************************************************************************
67extern "C" void __wcpp_4_undefined_member_function_(void)
68{
69 int3();
70}
71//*****************************************************************************
72//*****************************************************************************
73extern "C" void __wcpp_4_pure_error_(void)
74{
75 int3();
76}
77//*****************************************************************************
78//*****************************************************************************
79extern "C" void __wcpp_4_undef_vfun_(void)
80{
81 int3();
82}
83//*****************************************************************************
84//*****************************************************************************
85void* operator new(unsigned u)
86{
87#ifdef DEBUGHEAP
88 return malloc(u, __FILE__, __LINE__);
89#else
90 return malloc(u);
91#endif
92}
93//*****************************************************************************
94//*****************************************************************************
95void operator delete(void *p)
96{
97#ifdef DEBUGHEAP
98 free(p, __FILE__, __LINE__);
99#else
100 free(p);
101#endif
102}
103//*****************************************************************************
104//*****************************************************************************
105void *operator new(unsigned u, void near *p)
106{
107 return u ? p : NULL;
108}
109//*****************************************************************************
110//*****************************************************************************
111#if !defined(KEE)
112static GINFO FAR48 *pGIS = 0;
113#endif
114//*****************************************************************************
115//*****************************************************************************
116//PS++ Begin
117extern "C"
118{
119#pragma pack(1)
120#include "infoseg.h"
121#pragma pack()
122extern PVOID KernSISData;
123#define KernSISData ((struct InfoSegGDT *)&KernSISData)
124}
125ULONG os2gettimesec()
126{
127#if !defined(KEE)
128 APIRET rc;
129 FARPTR16 p;
130
131 if(pGIS == NULL) {
132 // Build a pointer to the Global Information Segment.
133 rc = DevGetDOSVar( DHGETDOSV_SYSINFOSEG, 0, (VOID NEAR *)&p );
134 if (rc) {
135 return 0;
136 }
137 SEL FAR48 *pSel = (SEL FAR48 *)MAKE_FARPTR32(p);
138 pGIS = (GINFO FAR48 *)MAKE_FARPTR32((ULONG)(*pSel << 16));
139 }
140 return pGIS->Time;
141#else
142 return KernSISData->SIS_BigTime;
143#endif
144}
145//*****************************************************************************
146//*****************************************************************************
147ULONG os2gettimemsec()
148{
149#if !defined(KEE)
150 APIRET rc;
151 FARPTR16 p;
152
153 if(pGIS == NULL) {
154 // Build a pointer to the Global Information Segment.
155 rc = DevGetDOSVar( DHGETDOSV_SYSINFOSEG, 0, (VOID NEAR *)&p );
156 if (rc) {
157 return 0;
158 }
159 SEL FAR48 *pSel = (SEL FAR48 *)MAKE_FARPTR32(p);
160 pGIS = (GINFO FAR48 *)MAKE_FARPTR32((ULONG)(*pSel << 16));
161 }
162 return pGIS->MilliSeconds;
163#else
164 return KernSISData->SIS_MsCount;
165#endif
166}
167//PS++ End
168//*****************************************************************************
169//*****************************************************************************
170
Note: See TracBrowser for help on using the repository browser.