mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
remove more cruft
svn path=/trunk/; revision=13613
This commit is contained in:
parent
a1c0271111
commit
f0d29764b0
23 changed files with 0 additions and 1123 deletions
|
@ -1,18 +0,0 @@
|
|||
#include "precomp.h"
|
||||
#include <msvcrt/malloc.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
void* _expand(void* pold, size_t size)
|
||||
{
|
||||
return HeapReAlloc(GetProcessHeap(), HEAP_REALLOC_IN_PLACE_ONLY, pold, size);
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
size_t _msize(void* pBlock)
|
||||
{
|
||||
return HeapSize (GetProcessHeap(), 0, pBlock);
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#include "precomp.h"
|
||||
#include <msvcrt/malloc.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _heapchk(void)
|
||||
{
|
||||
if (!HeapValidate(GetProcessHeap(), 0, NULL))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _heapmin(void)
|
||||
{
|
||||
if (!HeapCompact(GetProcessHeap(), 0))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _heapset(unsigned int unFill)
|
||||
{
|
||||
if (_heapchk() == -1)
|
||||
return -1;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _heapwalk(struct _heapinfo* entry)
|
||||
{
|
||||
return 0;
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <msvcrt/internal/quad.h>
|
||||
|
||||
/*
|
||||
* Divide two signed quads.
|
||||
* ??? if -1/2 should produce -1 on this machine, this code is wrong
|
||||
*/
|
||||
quad_t
|
||||
__divdi3(a, b)
|
||||
quad_t a, b;
|
||||
{
|
||||
u_quad_t ua, ub, uq;
|
||||
int neg;
|
||||
|
||||
if (a < 0)
|
||||
ua = -(u_quad_t)a, neg = 1;
|
||||
else
|
||||
ua = a, neg = 0;
|
||||
if (b < 0)
|
||||
ub = -(u_quad_t)b, neg ^= 1;
|
||||
else
|
||||
ub = b;
|
||||
uq = __qdivrem(ua, ub, (u_quad_t *)0);
|
||||
return (neg ? -uq : uq);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <msvcrt/internal/quad.h>
|
||||
|
||||
/*
|
||||
* Return remainder after dividing two signed quads.
|
||||
*
|
||||
* XXX
|
||||
* If -1/2 should produce -1 on this machine, this code is wrong.
|
||||
*/
|
||||
quad_t
|
||||
__moddi3(a, b)
|
||||
quad_t a, b;
|
||||
{
|
||||
u_quad_t ua, ub, ur;
|
||||
int neg;
|
||||
|
||||
if (a < 0)
|
||||
ua = -(u_quad_t)a, neg = 1;
|
||||
else
|
||||
ua = a, neg = 0;
|
||||
if (b < 0)
|
||||
ub = -(u_quad_t)b, neg ^= 1;
|
||||
else
|
||||
ub = b;
|
||||
(void)__qdivrem(ua, ub, &ur);
|
||||
return (neg ? -ur : ur);
|
||||
}
|
|
@ -1,281 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Multiprecision divide. This algorithm is from Knuth vol. 2 (2nd ed),
|
||||
* section 4.3.1, pp. 257--259.
|
||||
*/
|
||||
|
||||
#include <msvcrt/internal/quad.h>
|
||||
|
||||
#define B (1 << HALF_BITS) /* digit base */
|
||||
|
||||
/* Combine two `digits' to make a single two-digit number. */
|
||||
#define COMBINE(a, b) (((u_long)(a) << HALF_BITS) | (b))
|
||||
|
||||
/* select a type for digits in base B: use unsigned short if they fit */
|
||||
//#if (ULONG_MAX == 0xffffffff && USHRT_MAX >= 0xffff)
|
||||
//typedef unsigned short digit;
|
||||
//#else
|
||||
typedef u_long digit;
|
||||
//#endif
|
||||
|
||||
/*
|
||||
* Shift p[0]..p[len] left `sh' bits, ignoring any bits that
|
||||
* `fall out' the left (there never will be any such anyway).
|
||||
* We may assume len >= 0. NOTE THAT THIS WRITES len+1 DIGITS.
|
||||
*/
|
||||
static void
|
||||
shl(register digit *p, register int len, register int sh)
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
p[i] = LHALF(p[i] << sh) | (p[i + 1] >> (HALF_BITS - sh));
|
||||
p[i] = LHALF(p[i] << sh);
|
||||
}
|
||||
|
||||
/*
|
||||
* __qdivrem(u, v, rem) returns u/v and, optionally, sets *rem to u%v.
|
||||
*
|
||||
* We do this in base 2-sup-HALF_BITS, so that all intermediate products
|
||||
* fit within u_long. As a consequence, the maximum length dividend and
|
||||
* divisor are 4 `digits' in this base (they are shorter if they have
|
||||
* leading zeros).
|
||||
*/
|
||||
u_quad_t
|
||||
__qdivrem(uq, vq, arq)
|
||||
u_quad_t uq, vq, *arq;
|
||||
{
|
||||
union uu tmp;
|
||||
digit *u, *v, *q;
|
||||
register digit v1, v2;
|
||||
u_long qhat, rhat, t;
|
||||
int m, n, d, j, i;
|
||||
digit uspace[5], vspace[5], qspace[5];
|
||||
|
||||
/*
|
||||
* Take care of special cases: divide by zero, and u < v.
|
||||
*/
|
||||
if (vq == 0) {
|
||||
/* divide by zero. */
|
||||
static volatile const unsigned int zero = 0;
|
||||
|
||||
tmp.ul[H] = tmp.ul[L] = 1 / zero;
|
||||
if (arq)
|
||||
*arq = uq;
|
||||
return (tmp.q);
|
||||
}
|
||||
if (uq < vq) {
|
||||
if (arq)
|
||||
*arq = uq;
|
||||
return (0);
|
||||
}
|
||||
u = &uspace[0];
|
||||
v = &vspace[0];
|
||||
q = &qspace[0];
|
||||
|
||||
/*
|
||||
* Break dividend and divisor into digits in base B, then
|
||||
* count leading zeros to determine m and n. When done, we
|
||||
* will have:
|
||||
* u = (u[1]u[2]...u[m+n]) sub B
|
||||
* v = (v[1]v[2]...v[n]) sub B
|
||||
* v[1] != 0
|
||||
* 1 < n <= 4 (if n = 1, we use a different division algorithm)
|
||||
* m >= 0 (otherwise u < v, which we already checked)
|
||||
* m + n = 4
|
||||
* and thus
|
||||
* m = 4 - n <= 2
|
||||
*/
|
||||
tmp.uq = uq;
|
||||
u[0] = 0;
|
||||
u[1] = HHALF(tmp.ul[H]);
|
||||
u[2] = LHALF(tmp.ul[H]);
|
||||
u[3] = HHALF(tmp.ul[L]);
|
||||
u[4] = LHALF(tmp.ul[L]);
|
||||
tmp.uq = vq;
|
||||
v[1] = HHALF(tmp.ul[H]);
|
||||
v[2] = LHALF(tmp.ul[H]);
|
||||
v[3] = HHALF(tmp.ul[L]);
|
||||
v[4] = LHALF(tmp.ul[L]);
|
||||
for (n = 4; v[1] == 0; v++) {
|
||||
if (--n == 1) {
|
||||
u_long rbj; /* r*B+u[j] (not root boy jim) */
|
||||
digit q1, q2, q3, q4;
|
||||
|
||||
/*
|
||||
* Change of plan, per exercise 16.
|
||||
* r = 0;
|
||||
* for j = 1..4:
|
||||
* q[j] = floor((r*B + u[j]) / v),
|
||||
* r = (r*B + u[j]) % v;
|
||||
* We unroll this completely here.
|
||||
*/
|
||||
t = v[2]; /* nonzero, by definition */
|
||||
q1 = u[1] / t;
|
||||
rbj = COMBINE(u[1] % t, u[2]);
|
||||
q2 = rbj / t;
|
||||
rbj = COMBINE(rbj % t, u[3]);
|
||||
q3 = rbj / t;
|
||||
rbj = COMBINE(rbj % t, u[4]);
|
||||
q4 = rbj / t;
|
||||
if (arq)
|
||||
*arq = rbj % t;
|
||||
tmp.ul[H] = COMBINE(q1, q2);
|
||||
tmp.ul[L] = COMBINE(q3, q4);
|
||||
return (tmp.q);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* By adjusting q once we determine m, we can guarantee that
|
||||
* there is a complete four-digit quotient at &qspace[1] when
|
||||
* we finally stop.
|
||||
*/
|
||||
for (m = 4 - n; u[1] == 0; u++)
|
||||
m--;
|
||||
for (i = 4 - m; --i >= 0;)
|
||||
q[i] = 0;
|
||||
q += 4 - m;
|
||||
|
||||
/*
|
||||
* Here we run Program D, translated from MIX to C and acquiring
|
||||
* a few minor changes.
|
||||
*
|
||||
* D1: choose multiplier 1 << d to ensure v[1] >= B/2.
|
||||
*/
|
||||
d = 0;
|
||||
for (t = v[1]; t < B / 2; t <<= 1)
|
||||
d++;
|
||||
if (d > 0) {
|
||||
shl(&u[0], m + n, d); /* u <<= d */
|
||||
shl(&v[1], n - 1, d); /* v <<= d */
|
||||
}
|
||||
/*
|
||||
* D2: j = 0.
|
||||
*/
|
||||
j = 0;
|
||||
v1 = v[1]; /* for D3 -- note that v[1..n] are constant */
|
||||
v2 = v[2]; /* for D3 */
|
||||
do {
|
||||
register digit uj0, uj1, uj2;
|
||||
|
||||
/*
|
||||
* D3: Calculate qhat (\^q, in TeX notation).
|
||||
* Let qhat = min((u[j]*B + u[j+1])/v[1], B-1), and
|
||||
* let rhat = (u[j]*B + u[j+1]) mod v[1].
|
||||
* While rhat < B and v[2]*qhat > rhat*B+u[j+2],
|
||||
* decrement qhat and increase rhat correspondingly.
|
||||
* Note that if rhat >= B, v[2]*qhat < rhat*B.
|
||||
*/
|
||||
uj0 = u[j + 0]; /* for D3 only -- note that u[j+...] change */
|
||||
uj1 = u[j + 1]; /* for D3 only */
|
||||
uj2 = u[j + 2]; /* for D3 only */
|
||||
if (uj0 == v1) {
|
||||
qhat = B;
|
||||
rhat = uj1;
|
||||
goto qhat_too_big;
|
||||
} else {
|
||||
u_long n = COMBINE(uj0, uj1);
|
||||
qhat = n / v1;
|
||||
rhat = n % v1;
|
||||
}
|
||||
while (v2 * qhat > COMBINE(rhat, uj2)) {
|
||||
qhat_too_big:
|
||||
qhat--;
|
||||
if ((rhat += v1) >= B)
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* D4: Multiply and subtract.
|
||||
* The variable `t' holds any borrows across the loop.
|
||||
* We split this up so that we do not require v[0] = 0,
|
||||
* and to eliminate a final special case.
|
||||
*/
|
||||
for (t = 0, i = n; i > 0; i--) {
|
||||
t = u[i + j] - v[i] * qhat - t;
|
||||
u[i + j] = LHALF(t);
|
||||
t = (B - HHALF(t)) & (B - 1);
|
||||
}
|
||||
t = u[j] - t;
|
||||
u[j] = LHALF(t);
|
||||
/*
|
||||
* D5: test remainder.
|
||||
* There is a borrow if and only if HHALF(t) is nonzero;
|
||||
* in that (rare) case, qhat was too large (by exactly 1).
|
||||
* Fix it by adding v[1..n] to u[j..j+n].
|
||||
*/
|
||||
if (HHALF(t)) {
|
||||
qhat--;
|
||||
for (t = 0, i = n; i > 0; i--) { /* D6: add back. */
|
||||
t += u[i + j] + v[i];
|
||||
u[i + j] = LHALF(t);
|
||||
t = HHALF(t);
|
||||
}
|
||||
u[j] = LHALF(u[j] + t);
|
||||
}
|
||||
q[j] = qhat;
|
||||
} while (++j <= m); /* D7: loop on j. */
|
||||
|
||||
/*
|
||||
* If caller wants the remainder, we have to calculate it as
|
||||
* u[m..m+n] >> d (this is at most n digits and thus fits in
|
||||
* u[m+1..m+n], but we may need more source digits).
|
||||
*/
|
||||
if (arq) {
|
||||
if (d) {
|
||||
for (i = m + n; i > m; --i)
|
||||
u[i] = (u[i] >> d) |
|
||||
LHALF(u[i - 1] << (HALF_BITS - d));
|
||||
u[i] = 0;
|
||||
}
|
||||
tmp.ul[H] = COMBINE(uspace[1], uspace[2]);
|
||||
tmp.ul[L] = COMBINE(uspace[3], uspace[4]);
|
||||
*arq = tmp.q;
|
||||
}
|
||||
|
||||
tmp.ul[H] = COMBINE(qspace[1], qspace[2]);
|
||||
tmp.ul[L] = COMBINE(qspace[3], qspace[4]);
|
||||
return (tmp.q);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <msvcrt/internal/quad.h>
|
||||
|
||||
/*
|
||||
* Divide two unsigned quads.
|
||||
*/
|
||||
u_quad_t
|
||||
__udivdi3(a, b)
|
||||
u_quad_t a, b;
|
||||
{
|
||||
|
||||
return (__qdivrem(a, b, (u_quad_t *)0));
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <msvcrt/internal/quad.h>
|
||||
|
||||
/*
|
||||
* Return remainder after dividing two unsigned quads.
|
||||
*/
|
||||
u_quad_t
|
||||
__umoddi3(a, b)
|
||||
u_quad_t a, b;
|
||||
{
|
||||
u_quad_t r;
|
||||
|
||||
(void)__qdivrem(a, b, &r);
|
||||
return (r);
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
#include <msvcrt/string.h>
|
||||
|
||||
/*
|
||||
* This is a CRTDLL internal function to return the lasttoken
|
||||
* bit of data used by strtok. The reason for it's existence is
|
||||
* so that CRTDLL can use MSVCRT's implementation of strtok.
|
||||
*/
|
||||
char** _lasttoken()
|
||||
{
|
||||
static char *lasttoken = NULL;
|
||||
return &lasttoken;
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* string_old.c
|
||||
*
|
||||
* Oldnames from ANSI header string.h
|
||||
*
|
||||
* Some wrapper functions for those old name functions whose appropriate
|
||||
* equivalents are not simply underscore prefixed.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAMED. This includes but is not limited to warrenties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Author$
|
||||
* $Date$
|
||||
*
|
||||
*/
|
||||
|
||||
#include <msvcrt/string.h>
|
||||
#include <msvcrt/wchar.h>
|
||||
|
||||
int
|
||||
strcasecmp (const char* sz1, const char* sz2)
|
||||
{
|
||||
return _stricmp (sz1, sz2);
|
||||
}
|
||||
|
||||
int
|
||||
strncasecmp (const char* sz1, const char* sz2, size_t sizeMaxCompare)
|
||||
{
|
||||
return _strnicmp (sz1, sz2, sizeMaxCompare);
|
||||
}
|
||||
|
||||
int
|
||||
wcscmpi (const wchar_t* ws1, const wchar_t* ws2)
|
||||
{
|
||||
//return wcsicmp (ws1, ws2);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/string.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/errno.h>
|
||||
|
||||
|
||||
char __syserr00[] = "No Error";
|
||||
char __syserr01[] = "Input to function out of range (EDOM)";
|
||||
char __syserr02[] = "Output of function out of range (ERANGE)";
|
||||
char __syserr03[] = "Argument list too long (E2BIG)";
|
||||
char __syserr04[] = "Permission denied (EACCES)";
|
||||
char __syserr05[] = "Resource temporarily unavailable (EAGAIN)";
|
||||
char __syserr06[] = "Bad file descriptor (EBADF)";
|
||||
char __syserr07[] = "Resource busy (EBUSY)";
|
||||
char __syserr08[] = "No child processes (ECHILD)";
|
||||
char __syserr09[] = "Resource deadlock avoided (EDEADLK)";
|
||||
char __syserr10[] = "File exists (EEXIST)";
|
||||
char __syserr11[] = "Bad address (EFAULT)";
|
||||
char __syserr12[] = "File too large (EFBIG)";
|
||||
char __syserr13[] = "Interrupted system call (EINTR)";
|
||||
char __syserr14[] = "Invalid argument (EINVAL)";
|
||||
char __syserr15[] = "Input or output error (EIO)";
|
||||
char __syserr16[] = "Is a directory (EISDIR)";
|
||||
char __syserr17[] = "Too many open files (EMFILE)";
|
||||
char __syserr18[] = "Too many links (EMLINK)";
|
||||
char __syserr19[] = "File name too long (ENAMETOOLONG)";
|
||||
char __syserr20[] = "Too many open files in system (ENFILE)";
|
||||
char __syserr21[] = "No such device (ENODEV)";
|
||||
char __syserr22[] = "No such file or directory (ENOENT)";
|
||||
char __syserr23[] = "Unable to execute file (ENOEXEC)";
|
||||
char __syserr24[] = "No locks available (ENOLCK)";
|
||||
char __syserr25[] = "Not enough memory (ENOMEM)";
|
||||
char __syserr26[] = "No space left on drive (ENOSPC)";
|
||||
char __syserr27[] = "Function not implemented (ENOSYS)";
|
||||
char __syserr28[] = "Not a directory (ENOTDIR)";
|
||||
char __syserr29[] = "Directory not empty (ENOTEMPTY)";
|
||||
char __syserr30[] = "Inappropriate I/O control operation (ENOTTY)";
|
||||
char __syserr31[] = "No such device or address (ENXIO)";
|
||||
char __syserr32[] = "Operation not permitted (EPERM)";
|
||||
char __syserr33[] = "Broken pipe (EPIPE)";
|
||||
char __syserr34[] = "Read-only file system (EROFS)";
|
||||
char __syserr35[] = "Invalid seek (ESPIPE)";
|
||||
char __syserr36[] = "No such process (ESRCH)";
|
||||
char __syserr37[] = "Improper link (EXDEV)";
|
||||
char __syserr38[] = "No more files (ENMFILE)";
|
||||
|
||||
const char *_sys_errlist[] = {
|
||||
__syserr00, __syserr01, __syserr02, __syserr03, __syserr04,
|
||||
__syserr05, __syserr06, __syserr07, __syserr08, __syserr09,
|
||||
__syserr10, __syserr11, __syserr12, __syserr13, __syserr14,
|
||||
__syserr15, __syserr16, __syserr17, __syserr18, __syserr19,
|
||||
__syserr20, __syserr21, __syserr22, __syserr23, __syserr24,
|
||||
__syserr25, __syserr26, __syserr27, __syserr28, __syserr29,
|
||||
__syserr30, __syserr31, __syserr32, __syserr33, __syserr34,
|
||||
__syserr35, __syserr36, __syserr37, __syserr38
|
||||
};
|
||||
|
||||
int __sys_nerr = sizeof(_sys_errlist) / sizeof(_sys_errlist[0]);
|
||||
|
||||
int* _sys_nerr_dll = &__sys_nerr;
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*
|
||||
*/
|
||||
char *strerror(int errnum)
|
||||
{
|
||||
static char ebuf[40]; /* 64-bit number + slop */
|
||||
char *cp;
|
||||
int v=1000000, lz=0;
|
||||
|
||||
if (errnum >= 0 && errnum < __sys_nerr)
|
||||
return((char *)_sys_errlist[errnum]);
|
||||
|
||||
strcpy(ebuf, "Unknown error: ");
|
||||
cp = ebuf + 15;
|
||||
if (errnum < 0)
|
||||
{
|
||||
*cp++ = '-';
|
||||
errnum = -errnum;
|
||||
}
|
||||
while (v)
|
||||
{
|
||||
int d = errnum / v;
|
||||
if (d || lz || (v == 1))
|
||||
{
|
||||
*cp++ = d+'0';
|
||||
lz = 1;
|
||||
}
|
||||
errnum %= v;
|
||||
v /= 10;
|
||||
}
|
||||
|
||||
return ebuf;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*
|
||||
*/
|
||||
char *_strerror(const char *s)
|
||||
{
|
||||
if ( s == NULL )
|
||||
return strerror(errno);
|
||||
|
||||
return strerror(atoi(s));
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <msvcrt/string.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
char* strtok(char *s, const char *delim)
|
||||
{
|
||||
const char *spanp;
|
||||
int c, sc;
|
||||
char *tok;
|
||||
static char *last;
|
||||
|
||||
|
||||
if (s == NULL && (s = last) == NULL)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Skip (span) leading delimiters (s += strspn(s, delim), sort of).
|
||||
*/
|
||||
cont:
|
||||
c = *s++;
|
||||
for (spanp = delim; (sc = *spanp++) != 0;) {
|
||||
if (c == sc)
|
||||
goto cont;
|
||||
}
|
||||
|
||||
if (c == 0) { /* no non-delimiter characters */
|
||||
last = NULL;
|
||||
return (NULL);
|
||||
}
|
||||
tok = s - 1;
|
||||
|
||||
/*
|
||||
* Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
|
||||
* Note that delim must have one NUL; we stop if we see that, too.
|
||||
*/
|
||||
for (;;) {
|
||||
c = *s++;
|
||||
spanp = delim;
|
||||
do {
|
||||
if ((sc = *spanp++) == c) {
|
||||
if (c == 0)
|
||||
s = NULL;
|
||||
else
|
||||
s[-1] = 0;
|
||||
last = s;
|
||||
return (tok);
|
||||
}
|
||||
} while (sc != 0);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
#include <msvcrt/string.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
char * _strdec(const char *str1, const char *str2)
|
||||
{
|
||||
return (char *) (( str1 >= str2 ) ? ( str1 ) : --str2);
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#include <msvcrt/string.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
char * _strinc(const char *str)
|
||||
{
|
||||
return (char *)(++str);
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
#include <msvcrt/sys/types.h>
|
||||
#include <msvcrt/string.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
size_t _strncnt( const char *str, size_t max)
|
||||
{
|
||||
return strnlen(str,max);
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
#include <msvcrt/string.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _strnextc(const char *str)
|
||||
{
|
||||
return *(++str);
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
#include <msvcrt/string.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
char * _strninc(const char *str, size_t inc)
|
||||
{
|
||||
return (char *)(str + inc);
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
#include <msvcrt/string.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
char * _strspnp( const char * str1, const char * str2)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double wcstod(const wchar_t* s, wchar_t** sret)
|
||||
{
|
||||
long double r; /* result */
|
||||
int e; /* exponent */
|
||||
long double d; /* scale */
|
||||
int sign; /* +- 1.0 */
|
||||
int esign;
|
||||
int i;
|
||||
int flags=0;
|
||||
|
||||
r = 0.0;
|
||||
sign = 1;
|
||||
e = 0;
|
||||
esign = 1;
|
||||
|
||||
while ((*s == L' ') || (*s == L'\t'))
|
||||
s++;
|
||||
|
||||
if (*s == L'+')
|
||||
s++;
|
||||
else if (*s == L'-')
|
||||
{
|
||||
sign = -1;
|
||||
s++;
|
||||
}
|
||||
|
||||
while ((*s >= L'0') && (*s <= L'9'))
|
||||
{
|
||||
flags |= 1;
|
||||
r *= 10.0;
|
||||
r += *s - L'0';
|
||||
s++;
|
||||
}
|
||||
|
||||
if (*s == L'.')
|
||||
{
|
||||
d = 0.1L;
|
||||
s++;
|
||||
while ((*s >= L'0') && (*s <= L'9'))
|
||||
{
|
||||
flags |= 2;
|
||||
r += d * (*s - L'0');
|
||||
s++;
|
||||
d *= 0.1L;
|
||||
}
|
||||
}
|
||||
|
||||
if (flags == 0)
|
||||
{
|
||||
if (sret)
|
||||
*sret = (wchar_t *)s;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((*s == L'e') || (*s == L'E'))
|
||||
{
|
||||
s++;
|
||||
if (*s == L'+')
|
||||
s++;
|
||||
else if (*s == L'-')
|
||||
{
|
||||
s++;
|
||||
esign = -1;
|
||||
}
|
||||
if ((*s < L'0') || (*s > L'9'))
|
||||
{
|
||||
if (sret)
|
||||
*sret = (wchar_t *)s;
|
||||
return r;
|
||||
}
|
||||
|
||||
while ((*s >= L'0') && (*s <= L'9'))
|
||||
{
|
||||
e *= 10;
|
||||
e += *s - L'0';
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
if (esign < 0)
|
||||
for (i = 1; i <= e; i++)
|
||||
r *= 0.1L;
|
||||
else
|
||||
for (i = 1; i <= e; i++)
|
||||
r *= 10.0;
|
||||
|
||||
if (sret)
|
||||
*sret = (wchar_t *)s;
|
||||
return r * sign;
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
#include <msvcrt/string.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
wchar_t *wcstok(wchar_t *s, const wchar_t *ct)
|
||||
{
|
||||
const wchar_t *spanp;
|
||||
int c, sc;
|
||||
wchar_t *tok;
|
||||
static wchar_t *last;
|
||||
|
||||
if (s == NULL && (s = last) == NULL)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Skip (span) leading ctiters (s += strspn(s, ct), sort of).
|
||||
*/
|
||||
cont:
|
||||
c = *s;
|
||||
s++;
|
||||
for (spanp = ct; (sc = *spanp) != 0;spanp++) {
|
||||
if (c == sc)
|
||||
goto cont;
|
||||
}
|
||||
|
||||
if (c == 0) { /* no non-ctiter characters */
|
||||
last = NULL;
|
||||
return (NULL);
|
||||
}
|
||||
tok = s - 2;
|
||||
|
||||
/*
|
||||
* Scan token (scan for ctiters: s += strcspn(s, ct), sort of).
|
||||
* Note that ct must have one NUL; we stop if we see that, too.
|
||||
*/
|
||||
for (;;) {
|
||||
c = *s;
|
||||
s+=2;
|
||||
spanp = ct;
|
||||
do {
|
||||
if ((sc = *spanp) == c) {
|
||||
if (c == 0)
|
||||
s = NULL;
|
||||
else
|
||||
s[-1] = 0;
|
||||
last = s;
|
||||
return (tok);
|
||||
}
|
||||
spanp+=2;
|
||||
} while (sc != 0);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
#include <msvcrt/wchar.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
long wcstol(const wchar_t* cp, wchar_t** endp, int base)
|
||||
{
|
||||
long result = 0, value;
|
||||
int sign = 1;
|
||||
|
||||
if (*cp == L'-') {
|
||||
sign = -1;
|
||||
cp++;
|
||||
}
|
||||
|
||||
if (!base) {
|
||||
base = 10;
|
||||
if (*cp == L'0') {
|
||||
base = 8;
|
||||
cp++;
|
||||
if ((*cp == L'x') && iswxdigit(cp[1])) {
|
||||
cp++;
|
||||
base = 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (iswxdigit(*cp) && (value = iswdigit(*cp) ? *cp-L'0' : (iswlower(*cp)
|
||||
? towupper(*cp) : *cp)-L'A'+10) < base) {
|
||||
result = result*base + value;
|
||||
cp++;
|
||||
}
|
||||
if (endp)
|
||||
*endp = (wchar_t*)cp;
|
||||
return result * sign;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned long wcstoul(const wchar_t* cp, wchar_t** endp, int base)
|
||||
{
|
||||
unsigned long result = 0, value;
|
||||
|
||||
if (!base) {
|
||||
base = 10;
|
||||
if (*cp == L'0') {
|
||||
base = 8;
|
||||
cp++;
|
||||
if ((*cp == L'x') && iswxdigit(cp[1])) {
|
||||
cp++;
|
||||
base = 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (iswxdigit(*cp) && (value = iswdigit(*cp) ? *cp-L'0' : (iswlower(*cp)
|
||||
? towupper(*cp) : *cp)-L'A'+10) < base) {
|
||||
result = result*base + value;
|
||||
cp++;
|
||||
}
|
||||
if (endp)
|
||||
*endp = (wchar_t*)cp;
|
||||
return result;
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
#include <msvcrt/wchar.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
size_t wcstombs( char *dst, const wchar_t *src, size_t len )
|
||||
{
|
||||
return 0;
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
#include <msvcrt/wchar.h>
|
||||
|
||||
/*
|
||||
* This is a CRTDLL internal function to return the lasttoken
|
||||
* bit of data used by wcstok. The reason for it's existence is
|
||||
* so that CRTDLL can use MSVCRT's implementation of wcstok.
|
||||
*/
|
||||
wchar_t** _wlasttoken()
|
||||
{
|
||||
static wchar_t *wlasttoken = NULL;
|
||||
return &wlasttoken;
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
#include <msvcrt/wchar.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*
|
||||
* this function is now forwarded to NTDLL._wtoi to reduce code duplication
|
||||
*/
|
||||
#if 0
|
||||
int _wtoi(const wchar_t* str)
|
||||
{
|
||||
return (int)wcstol(str, 0, 10);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*
|
||||
* this function is now forwarded to NTDLL._wtol to reduce code duplication
|
||||
*/
|
||||
#if 0
|
||||
long _wtol(const wchar_t* str)
|
||||
{
|
||||
return (int)wcstol(str, 0, 10);
|
||||
}
|
||||
#endif
|
Loading…
Reference in a new issue