source: GPL/branches/uniaud32-2.1.x/drv32/util.c@ 588

Last change on this file since 588 was 588, checked in by David Azarewicz, 9 years ago

Build system cleanup

File size: 5.1 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 void __wcpp_2_undefed_cdtor_(void)
38{
39 int3();
40}
41//*****************************************************************************
42//*****************************************************************************
43extern void __wcpp_2_undefined_member_function_(void)
44{
45 int3();
46}
47//*****************************************************************************
48//*****************************************************************************
49extern void __wcpp_2_pure_error_(void)
50{
51 int3();
52}
53//*****************************************************************************
54//*****************************************************************************
55extern void __wcpp_2_undef_vfun_(void)
56{
57 int3();
58}
59//*****************************************************************************
60//*****************************************************************************
61extern void __wcpp_4_undefed_cdtor_(void)
62{
63 int3();
64}
65//*****************************************************************************
66//*****************************************************************************
67extern void __wcpp_4_undefined_member_function_(void)
68{
69 int3();
70}
71//*****************************************************************************
72//*****************************************************************************
73extern void __wcpp_4_pure_error_(void)
74{
75 int3();
76}
77//*****************************************************************************
78//*****************************************************************************
79extern void __wcpp_4_undef_vfun_(void)
80{
81 int3();
82}
83#ifdef NOT_USED
84//*****************************************************************************
85//*****************************************************************************
86void* operator new(unsigned u)
87{
88#ifdef DEBUGHEAP
89 return malloc(u, __FILE__, __LINE__);
90#else
91 return malloc(u);
92#endif
93}
94//*****************************************************************************
95//*****************************************************************************
96void operator delete(void *p)
97{
98#ifdef DEBUGHEAP
99 free(p, __FILE__, __LINE__);
100#else
101 free(p);
102#endif
103}
104//*****************************************************************************
105//*****************************************************************************
106void *operator new(unsigned u, void near *p)
107{
108 return u ? p : NULL;
109}
110#endif
111
112//*****************************************************************************
113#if !defined(KEE)
114static GINFO FAR48 *pGIS = 0;
115#endif
116
117//*****************************************************************************
118//PS++ Begin
119#pragma pack(1)
120#include "infoseg.h"
121#pragma pack()
122extern PVOID KernSISData;
123#define KernSISData ((struct InfoSegGDT *)&KernSISData)
124ULONG os2gettimesec()
125{
126#if !defined(KEE)
127 APIRET rc;
128 FARPTR16 p;
129
130 if(pGIS == NULL) {
131 // Build a pointer to the Global Information Segment.
132 rc = DevGetDOSVar( DHGETDOSV_SYSINFOSEG, 0, (VOID NEAR *)&p );
133 if (rc) {
134 return 0;
135 }
136 SEL FAR48 *pSel = (SEL FAR48 *)MAKE_FARPTR32(p);
137 pGIS = (GINFO FAR48 *)MAKE_FARPTR32((ULONG)(*pSel << 16));
138 }
139 return pGIS->Time;
140#else
141 return KernSISData->SIS_BigTime;
142#endif
143}
144
145//*****************************************************************************
146ULONG os2gettimemsec()
147{
148#if !defined(KEE)
149 APIRET rc;
150 FARPTR16 p;
151
152 if(pGIS == NULL) {
153 // Build a pointer to the Global Information Segment.
154 rc = DevGetDOSVar( DHGETDOSV_SYSINFOSEG, 0, (VOID NEAR *)&p );
155 if (rc) {
156 return 0;
157 }
158 SEL FAR48 *pSel = (SEL FAR48 *)MAKE_FARPTR32(p);
159 pGIS = (GINFO FAR48 *)MAKE_FARPTR32((ULONG)(*pSel << 16));
160 }
161 return pGIS->MilliSeconds;
162#else
163 return KernSISData->SIS_MsCount;
164#endif
165}
166//PS++ End
167
Note: See TracBrowser for help on using the repository browser.