Changeset 7886


Ignore:
Timestamp:
Feb 12, 2002, 1:00:42 PM (23 years ago)
Author:
sandervl
Message:

moved Char functions from user32 to kernel32

Location:
trunk/src/kernel32
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/kernel32/KERNEL32.DEF

    r7861 r7886  
    1 ; $Id: KERNEL32.DEF,v 1.131 2002-02-11 09:43:05 sandervl Exp $
     1; $Id: KERNEL32.DEF,v 1.132 2002-02-12 12:00:41 sandervl Exp $
    22
    33;Basis is Windows95 KERNEL32
     
    12061206    _dbg_ThreadPushCall@4                                         @3107 NONAME
    12071207    _dbg_ThreadPopCall@0                                          @3108 NONAME
     1208
     1209; Char functions (forwarders from user32)
     1210    _CharLowerA@4                                                 @3127 NONAME
     1211    _CharLowerBuffA@8                                             @3128 NONAME
     1212    _CharLowerBuffW@8                                             @3129 NONAME
     1213    _CharLowerW@4                                                 @3130 NONAME
     1214    _CharNextA@4                                                  @3131 NONAME
     1215    _CharNextExA@12                                               @3132 NONAME
     1216    _CharNextExW@12                                               @3133 NONAME
     1217    _CharNextW@4                                                  @3134 NONAME
     1218    _CharPrevA@8                                                  @3135 NONAME
     1219    _CharPrevExA@16                                               @3136 NONAME
     1220    _CharPrevExW@16                                               @3137 NONAME
     1221    _CharPrevW@8                                                  @3138 NONAME
     1222    _CharToOemA@8                                                 @3139 NONAME
     1223    _CharToOemBuffA@12                                            @3140 NONAME
     1224    _CharToOemBuffW@12                                            @3141 NONAME
     1225    _CharToOemW@8                                                 @3142 NONAME
     1226    _CharUpperA@4                                                 @3143 NONAME
     1227    _CharUpperBuffA@8                                             @3144 NONAME
     1228    _CharUpperBuffW@8                                             @3145 NONAME
     1229    _CharUpperW@4                                                 @3146 NONAME
     1230    _OemToCharA@8                                                 @3149 NONAME
     1231    _OemToCharBuffA@12                                            @3150 NONAME
     1232    _OemToCharBuffW@12                                            @3151 NONAME
     1233    _OemToCharW@8                                                 @3152 NONAME
     1234    _IsCharAlphaA@4                                               @3153 NONAME
     1235    _IsCharAlphaNumericA@4                                        @3154 NONAME
     1236    _IsCharAlphaNumericW@4                                        @3155 NONAME
     1237    _IsCharAlphaW@4                                               @3156 NONAME
     1238    _IsCharLowerA@4                                               @3157 NONAME
     1239    _IsCharLowerW@4                                               @3158 NONAME
     1240    _IsCharUpperA@4                                               @3159 NONAME
     1241    _IsCharUpperW@4                                               @3160 NONAME
  • TabularUnified trunk/src/kernel32/char.cpp

    r7873 r7886  
    1 #include <odinwrap.h>
    2 #include <os2sel.h>
    3 
     1/* $Id: char.cpp,v 1.3 2002-02-12 12:00:41 sandervl Exp $ */
     2
     3/*
     4 * USER string functions
     5 *
     6 * Based on WINE code (dlls\user\lstr.c)
     7 *
     8 * Copyright 1993 Yngvi Sigurjonsson (yngvi@hafro.is)
     9 * Copyright 1996 Alexandre Julliard
     10 * Copyright 1996 Marcus Meissner
     11 *
     12 *
     13 * Project Odin Software License can be found in LICENSE.TXT
     14 *
     15 */
     16
     17
     18#include <ctype.h>
     19#include <stdarg.h>
     20#include <stdlib.h>
     21#include <stdio.h>
     22#include <string.h>
    423#include <os2win.h>
    5 #include <stdlib.h>
    6 #include <string.h>
    7 #include <winnls.h>
    8 
    9 #include "unicode.h"
    10 #include <heapstring.h>
    11 #include "handlemanager.h"
     24
     25#include "winnls.h"
     26
     27#include <misc.h>
     28#include <wine\unicode.h>
     29
     30
     31#define DBG_LOCALLOG    DBG_char
     32#include "dbglocal.h"
     33
     34
     35
     36/***********************************************************************
     37 *           CharNextA   (USER32.@)
     38 */
     39LPSTR WINAPI CharNextA( LPCSTR ptr )
     40{
     41    dprintf2(("CharNextA %x", ptr));
     42    if (!*ptr) return (LPSTR)ptr;
     43    if (IsDBCSLeadByte( ptr[0] ) && ptr[1]) return (LPSTR)(ptr + 2);
     44    return (LPSTR)(ptr + 1);
     45}
     46
     47
     48/***********************************************************************
     49 *           CharNextExA   (USER32.@)
     50 */
     51LPSTR WINAPI CharNextExA( WORD codepage, LPCSTR ptr, DWORD flags )
     52{
     53    dprintf2(("CharNextExA %d %x %x", codepage, ptr, flags));
     54
     55    if (!*ptr) return (LPSTR)ptr;
     56    if (IsDBCSLeadByteEx( codepage, ptr[0] ) && ptr[1]) return (LPSTR)(ptr + 2);
     57    return (LPSTR)(ptr + 1);
     58}
     59
     60
     61/***********************************************************************
     62 *           CharNextExW   (USER32.@)
     63 */
     64LPWSTR WINAPI CharNextExW( WORD codepage, LPCWSTR ptr, DWORD flags )
     65{
     66    dprintf2(("CharNextExW %d %x %x", codepage, ptr, flags));
     67    /* doesn't make sense, there are no codepages for Unicode */
     68    return NULL;
     69}
     70
     71
     72/***********************************************************************
     73 *           CharNextW   (USER32.@)
     74 */
     75LPWSTR WINAPI CharNextW(LPCWSTR x)
     76{
     77    dprintf2(("CharNextW %x", x));
     78
     79    if (*x) x++;
     80
     81    return (LPWSTR)x;
     82}
     83
     84
     85/***********************************************************************
     86 *           CharPrevA   (USER32.@)
     87 */
     88LPSTR WINAPI CharPrevA( LPCSTR start, LPCSTR ptr )
     89{
     90    dprintf2(("CharPrevA %x %x", start, ptr));
     91
     92    while (*start && (start < ptr))
     93    {
     94        LPCSTR next = CharNextA( start );
     95        if (next >= ptr) break;
     96        start = next;
     97    }
     98    return (LPSTR)start;
     99}
     100
     101
     102/***********************************************************************
     103 *           CharPrevExA   (USER32.@)
     104 */
     105LPSTR WINAPI CharPrevExA( WORD codepage, LPCSTR start, LPCSTR ptr, DWORD flags )
     106{
     107    dprintf2(("CharPrevExA %d %x %x %x", codepage, start, ptr, flags));
     108
     109    while (*start && (start < ptr))
     110    {
     111        LPCSTR next = CharNextExA( codepage, start, flags );
     112        if (next > ptr) break;
     113        start = next;
     114    }
     115    return (LPSTR)start;
     116}
     117
     118
     119/***********************************************************************
     120 *           CharPrevExW   (USER32.@)
     121 */
     122LPWSTR WINAPI CharPrevExW( WORD codepage, LPCWSTR start, LPCWSTR ptr, DWORD flags )
     123{
     124    /* doesn't make sense, there are no codepages for Unicode */
     125    dprintf2(("CharPrevExW %d %x %x %x", codepage, start, ptr, flags));
     126    return NULL;
     127}
     128
     129
     130/***********************************************************************
     131 *           CharPrevW   (USER32.@)
     132 */
     133LPWSTR WINAPI CharPrevW(LPCWSTR start,LPCWSTR x)
     134{
     135    dprintf2(("CharPrevW %x %x", start, x));
     136
     137    if (x>start) return (LPWSTR)(x-1);
     138    else return (LPWSTR)x;
     139}
     140
    12141
    13142/***********************************************************************
     
    41170
    42171
     172/***********************************************************************
     173 *           CharToOemBuffW   (USER32.@)
     174 */
     175BOOL WINAPI CharToOemBuffW( LPCWSTR s, LPSTR d, DWORD len )
     176{
     177   dprintf2(("CharToOemBuffW %x %x %d", s, d, len));
     178
     179   if ( !s || !d ) return TRUE;
     180    WideCharToMultiByte( CP_OEMCP, 0, s, len, d, len, NULL, NULL );
     181    return TRUE;
     182}
     183
     184
     185/***********************************************************************
     186 *           CharToOemW   (USER32.@)
     187 */
     188BOOL WINAPI CharToOemW( LPCWSTR s, LPSTR d )
     189{
     190    return CharToOemBuffW( s, d, strlenW( s ) + 1 );
     191}
     192
    43193
    44194/***********************************************************************
     
    70220}
    71221
     222
     223/***********************************************************************
     224 *           OemToCharBuffW   (USER32.@)
     225 */
     226BOOL WINAPI OemToCharBuffW( LPCSTR s, LPWSTR d, DWORD len )
     227{
     228    dprintf2(("OemToCharBuffW %x %x %d", s, d, len));
     229
     230    MultiByteToWideChar( CP_OEMCP, 0, s, len, d, len );
     231    return TRUE;
     232}
     233
     234
     235/***********************************************************************
     236 *           OemToCharW   (USER32.@)
     237 */
     238BOOL WINAPI OemToCharW( LPCSTR s, LPWSTR d )
     239{
     240    return OemToCharBuffW( s, d, strlen( s ) + 1 );
     241}
     242
     243
     244/***********************************************************************
     245 *           CharLowerA   (USER32.@)
     246 * FIXME: handle current locale
     247 */
     248LPSTR WINAPI CharLowerA(LPSTR x)
     249{
     250    LPSTR       s;
     251
     252    dprintf2(("CharLowerA %x", x));
     253
     254    if (HIWORD(x))
     255    {
     256        s=x;
     257        while (*s)
     258        {
     259            *s=tolower(*s);
     260            s++;
     261        }
     262        return x;
     263    }
     264    else return (LPSTR)tolower((char)(int)x);
     265}
     266
     267
     268/***********************************************************************
     269 *           CharUpperA   (USER32.@)
     270 * FIXME: handle current locale
     271 */
     272LPSTR WINAPI CharUpperA(LPSTR x)
     273{
     274    dprintf2(("CharUpperA %x", x));
     275
     276    if (HIWORD(x))
     277    {
     278        LPSTR s = x;
     279        while (*s)
     280        {
     281            *s=toupper(*s);
     282            s++;
     283        }
     284        return x;
     285    }
     286    return (LPSTR)toupper((char)(int)x);
     287}
     288
     289
     290/***********************************************************************
     291 *           CharLowerW   (USER32.@)
     292 */
     293LPWSTR WINAPI CharLowerW(LPWSTR x)
     294{
     295    dprintf2(("CharLowerW %x", x));
     296    if (HIWORD(x)) return strlwrW(x);
     297    else return (LPWSTR)((UINT)tolowerW(LOWORD(x)));
     298}
     299
     300
     301/***********************************************************************
     302 *           CharUpperW   (USER32.@)
     303 * FIXME: handle current locale
     304 */
     305LPWSTR WINAPI CharUpperW(LPWSTR x)
     306{
     307    dprintf2(("CharUpperW %x", x));
     308    if (HIWORD(x)) return struprW(x);
     309    else return (LPWSTR)((UINT)toupperW(LOWORD(x)));
     310}
     311
     312
     313/***********************************************************************
     314 *           CharLowerBuffA   (USER32.@)
     315 * FIXME: handle current locale
     316 */
     317DWORD WINAPI CharLowerBuffA( LPSTR str, DWORD len )
     318{
     319    DWORD ret = len;
     320
     321    dprintf2(("CharLowerBuffA %x %d", str, len));
     322
     323    if (!str) return 0; /* YES */
     324    for (; len; len--, str++) *str = tolower(*str);
     325    return ret;
     326}
     327
     328
     329/***********************************************************************
     330 *           CharLowerBuffW   (USER32.@)
     331 */
     332DWORD WINAPI CharLowerBuffW( LPWSTR str, DWORD len )
     333{
     334    DWORD ret = len;
     335
     336    dprintf2(("CharLowerBuffW %x %d", str, len));
     337
     338    if (!str) return 0; /* YES */
     339    for (; len; len--, str++) *str = tolowerW(*str);
     340    return ret;
     341}
     342
     343
     344/***********************************************************************
     345 *           CharUpperBuffA   (USER32.@)
     346 * FIXME: handle current locale
     347 */
     348DWORD WINAPI CharUpperBuffA( LPSTR str, DWORD len )
     349{
     350    DWORD ret = len;
     351
     352    dprintf2(("CharUpperBuffA %x %d", str, len));
     353
     354    if (!str) return 0; /* YES */
     355    for (; len; len--, str++) *str = toupper(*str);
     356    return ret;
     357}
     358
     359
     360/***********************************************************************
     361 *           CharUpperBuffW   (USER32.@)
     362 */
     363DWORD WINAPI CharUpperBuffW( LPWSTR str, DWORD len )
     364{
     365    DWORD ret = len;
     366
     367    dprintf2(("CharUpperBuffW %x %d", str, len));
     368
     369    if (!str) return 0; /* YES */
     370    for (; len; len--, str++) *str = toupperW(*str);
     371    return ret;
     372}
     373
     374
     375/***********************************************************************
     376 *           IsCharLowerA   (USER.436) (USER32.@)
     377 * FIXME: handle current locale
     378 */
     379BOOL WINAPI IsCharLowerA(CHAR x)
     380{
     381    dprintf2(("IsCharLowerA %x", x));
     382    return islower(x);
     383}
     384
     385
     386/***********************************************************************
     387 *           IsCharLowerW   (USER32.@)
     388 */
     389BOOL WINAPI IsCharLowerW(WCHAR x)
     390{
     391    dprintf2(("IsCharLowerW %x", x));
     392    return get_char_typeW(x) & C1_LOWER;
     393}
     394
     395
     396/***********************************************************************
     397 *           IsCharUpperA   (USER.435) (USER32.@)
     398 * FIXME: handle current locale
     399 */
     400BOOL WINAPI IsCharUpperA(CHAR x)
     401{
     402    dprintf2(("IsCharUpperA %x", x));
     403    return isupper(x);
     404}
     405
     406
     407/***********************************************************************
     408 *           IsCharUpperW   (USER32.@)
     409 */
     410BOOL WINAPI IsCharUpperW(WCHAR x)
     411{
     412    dprintf2(("IsCharUpperW %x", x));
     413    return get_char_typeW(x) & C1_UPPER;
     414}
     415
     416
     417/***********************************************************************
     418 *           IsCharAlphaNumericW   (USER32.@)
     419 */
     420BOOL WINAPI IsCharAlphaNumericW(WCHAR x)
     421{
     422    dprintf2(("IsCharAlphaNumericW %x", x));
     423    return get_char_typeW(x) & (C1_ALPHA|C1_DIGIT|C1_LOWER|C1_UPPER);
     424}
     425
     426
     427/***********************************************************************
     428 *           IsCharAlphaW   (USER32.@)
     429 */
     430BOOL WINAPI IsCharAlphaW(WCHAR x)
     431{
     432    dprintf2(("IsCharAlphaW %x", x));
     433    return get_char_typeW(x) & (C1_ALPHA|C1_LOWER|C1_UPPER);
     434}
     435//******************************************************************************
     436//******************************************************************************
     437BOOL WIN32API IsCharAlphaA( CHAR x)
     438{
     439    WCHAR wch;
     440
     441    dprintf(("USER32: IsCharAlphaA %x", x));
     442    MultiByteToWideChar(CP_ACP, 0, &x, 1, &wch, 1);
     443    return IsCharAlphaW(wch);
     444}
     445//******************************************************************************
     446//******************************************************************************
     447BOOL WIN32API IsCharAlphaNumericA( CHAR x)
     448{
     449    dprintf(("USER32: IsCharAlphaNumericA %x", x));
     450    return (get_char_typeW(x) & C1_ALPHA) != 0;
     451}
     452//******************************************************************************
     453//******************************************************************************
  • TabularUnified trunk/src/kernel32/dbglocal.cpp

    r7848 r7886  
    1 /* $Id: dbglocal.cpp,v 1.22 2002-02-09 11:52:22 sandervl Exp $ */
     1/* $Id: dbglocal.cpp,v 1.23 2002-02-12 12:00:41 sandervl Exp $ */
    22
    33/*
     
    135135"memory",
    136136"system",
    137 "string"
     137"string",
     138"char"
    138139};
    139140//******************************************************************************
  • TabularUnified trunk/src/kernel32/dbglocal.h

    r7848 r7886  
    133133#define DBG_system         113
    134134#define DBG_string         114
    135 #define DBG_MAXFILES       115
     135#define DBG_char           115
     136#define DBG_MAXFILES       116
    136137
    137138extern USHORT DbgEnabledKERNEL32[DBG_MAXFILES];
  • TabularUnified trunk/src/kernel32/dbgwrap.cpp

    r7883 r7886  
    899899DEBUGWRAP4(SetUnhandledExceptionFilter);
    900900DEBUGWRAP4(UnhandledExceptionFilter);
     901
     902#undef DBG_LOCALLOG
     903#define DBG_LOCALLOG    DBG_char
     904DEBUGWRAP4(CharLowerA)
     905DEBUGWRAP8(CharLowerBuffA)
     906DEBUGWRAP8(CharLowerBuffW)
     907DEBUGWRAP4(CharLowerW)
     908DEBUGWRAP4(CharNextA)
     909DEBUGWRAP12(CharNextExA)
     910DEBUGWRAP12(CharNextExW)
     911DEBUGWRAP4(CharNextW)
     912DEBUGWRAP8(CharPrevA)
     913DEBUGWRAP16(CharPrevExA)
     914DEBUGWRAP16(CharPrevExW)
     915DEBUGWRAP8(CharPrevW)
     916DEBUGWRAP8(CharToOemA)
     917DEBUGWRAP12(CharToOemBuffA)
     918DEBUGWRAP12(CharToOemBuffW)
     919DEBUGWRAP8(CharToOemW)
     920DEBUGWRAP4(CharUpperA)
     921DEBUGWRAP8(CharUpperBuffA)
     922DEBUGWRAP8(CharUpperBuffW)
     923DEBUGWRAP4(CharUpperW)
     924DEBUGWRAP4(IsCharAlphaA)
     925DEBUGWRAP4(IsCharAlphaNumericA)
     926DEBUGWRAP4(IsCharAlphaNumericW)
     927DEBUGWRAP4(IsCharAlphaW)
     928DEBUGWRAP4(IsCharLowerA)
     929DEBUGWRAP4(IsCharLowerW)
     930DEBUGWRAP4(IsCharUpperA)
     931DEBUGWRAP4(IsCharUpperW)
     932DEBUGWRAP8(OemToCharA)
     933DEBUGWRAP12(OemToCharBuffA)
     934DEBUGWRAP12(OemToCharBuffW)
     935DEBUGWRAP8(OemToCharW)
  • TabularUnified trunk/src/kernel32/kernel32dbg.def

    r7883 r7886  
    1 ; $Id: kernel32dbg.def,v 1.7 2002-02-12 11:43:32 sandervl Exp $
     1; $Id: kernel32dbg.def,v 1.8 2002-02-12 12:00:42 sandervl Exp $
    22
    33;Basis is Windows95 KERNEL32
     
    12061206    _dbg_ThreadPushCall@4                                         @3107 NONAME
    12071207    _dbg_ThreadPopCall@0                                          @3108 NONAME
     1208
     1209; Char functions (forwarders from user32)
     1210    _DbgCharLowerA@4                                                 @3127 NONAME
     1211    _DbgCharLowerBuffA@8                                             @3128 NONAME
     1212    _DbgCharLowerBuffW@8                                             @3129 NONAME
     1213    _DbgCharLowerW@4                                                 @3130 NONAME
     1214    _DbgCharNextA@4                                                  @3131 NONAME
     1215    _DbgCharNextExA@12                                               @3132 NONAME
     1216    _DbgCharNextExW@12                                               @3133 NONAME
     1217    _DbgCharNextW@4                                                  @3134 NONAME
     1218    _DbgCharPrevA@8                                                  @3135 NONAME
     1219    _DbgCharPrevExA@16                                               @3136 NONAME
     1220    _DbgCharPrevExW@16                                               @3137 NONAME
     1221    _DbgCharPrevW@8                                                  @3138 NONAME
     1222    _DbgCharToOemA@8                                                 @3139 NONAME
     1223    _DbgCharToOemBuffA@12                                            @3140 NONAME
     1224    _DbgCharToOemBuffW@12                                            @3141 NONAME
     1225    _DbgCharToOemW@8                                                 @3142 NONAME
     1226    _DbgCharUpperA@4                                                 @3143 NONAME
     1227    _DbgCharUpperBuffA@8                                             @3144 NONAME
     1228    _DbgCharUpperBuffW@8                                             @3145 NONAME
     1229    _DbgCharUpperW@4                                                 @3146 NONAME
     1230    _DbgOemToCharA@8                                                 @3149 NONAME
     1231    _DbgOemToCharBuffA@12                                            @3150 NONAME
     1232    _DbgOemToCharBuffW@12                                            @3151 NONAME
     1233    _DbgOemToCharW@8                                                 @3152 NONAME
     1234    _DbgIsCharAlphaA@4                                               @3153 NONAME
     1235    _DbgIsCharAlphaNumericA@4                                        @3154 NONAME
     1236    _DbgIsCharAlphaNumericW@4                                        @3155 NONAME
     1237    _DbgIsCharAlphaW@4                                               @3156 NONAME
     1238    _DbgIsCharLowerA@4                                               @3157 NONAME
     1239    _DbgIsCharLowerW@4                                               @3158 NONAME
     1240    _DbgIsCharUpperA@4                                               @3159 NONAME
     1241    _DbgIsCharUpperW@4                                               @3160 NONAME
Note: See TracChangeset for help on using the changeset viewer.