Changeset 3573 for trunk/kStuff/kHlp


Ignore:
Timestamp:
Aug 31, 2007, 6:09:23 AM (18 years ago)
Author:
bird
Message:

kHlp work...

Location:
trunk/kStuff/kHlp
Files:
7 added
7 moved

Legend:

Unmodified
Added
Removed
  • trunk/kStuff/kHlp/Bare/kHlpBare-gcc.c

    r3570 r3573  
    2626
    2727#include <k/kLdr.h>
    28 #include "kLdrHlp.h"
     28#include "kHlp.h"
    2929
    3030
  • trunk/kStuff/kHlp/Bare/kHlpBareHeap.c

    r3570 r3573  
    11/* $Id$ */
    22/** @file
    3  *
    4  * kLdr - The Dynamic Loader, Helper Functions, Heap.
    5  *
    6  * Copyright (c) 2006 knut st. osmundsen <bird-kbuild-src@anduin.net>
    7  *
    8  *
    9  * This file is part of kLdr.
    10  *
    11  * kLdr is free software; you can redistribute it and/or modify
    12  * it under the terms of the GNU General Public License as published by
    13  * the Free Software Foundation; either version 2 of the License, or
    14  * (at your option) any later version.
    15  *
    16  * kLdr is distributed in the hope that it will be useful,
     3 * kHlpBare - Heap.
     4 */
     5
     6/*
     7 * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net>
     8 *
     9 * This file is part of kStuff.
     10 *
     11 * kStuff is free software; you can redistribute it and/or
     12 * modify it under the terms of the GNU Lesser General Public
     13 * License as published by the Free Software Foundation; either
     14 * version 2.1 of the License, or (at your option) any later version.
     15 *
     16 * kStuff is distributed in the hope that it will be useful,
    1717 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    19  * GNU General Public License for more details.
    20  *
    21  * You should have received a copy of the GNU General Public License
    22  * along with kLdr; if not, write to the Free Software
    23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     19 * Lesser General Public License for more details.
     20 *
     21 * You should have received a copy of the GNU Lesser General Public
     22 * License along with kStuff; if not, write to the Free Software
     23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
    2424 *
    2525 */
     
    3030*   Header Files                                                               *
    3131*******************************************************************************/
    32 #ifdef __OS2__
     32#include <k/kHlpAlloc.h>
     33
     34#if K_OS == K_OS_OS2
    3335# define INCL_BASE
    3436# define INCL_ERRORS
    3537# include <os2.h>
    36 #elif defined(__WIN__)
     38#elif  K_OS == K_OS_WINDOWS
    3739# include <Windows.h>
    3840#else
    3941# error "port me"
    4042#endif
    41 
    42 #include <k/kLdr.h>
    43 #include "kLdrHlp.h"
    44 
    4543
    4644
     
    8785 * Assert that a heap free block is valid. */
    8886#ifdef KLDRHEAP_STRICT
    89 # define KLDRHEAP_ASSERT(expr)      kldrHlpAssert(expr)
     87# define KLDRHEAP_ASSERT(expr)      kHlpAssert(expr)
    9088
    9189# define KLDRHEAP_ASSERT_BLOCK(pHeap, pBlock) \
     
    193191 * @returns 0 on success, non-zero OS specific status code on failure.
    194192 */
    195 int kldrHlpHeapInit(void)
     193KHLP_DECL(int) kHlpHeapInit(void)
    196194{
    197195    return kLdrHeapInit(&g_Heap);
     
    202200 * Terminates the kLdr heap.
    203201 */
    204 void kldrHlpHeapTerm(void)
     202KHLP_DECL(void) kHlpHeapTerm(void)
    205203{
    206204    kLdrHeapDelete(&g_Heap);
     
    214212 * @param   cb      The requested heap block size.
    215213 */
    216 void *kldrHlpAlloc(KSIZE cb)
     214KHLP_DECL(void *) kHlpAlloc(KSIZE cb)
    217215{
    218216    return kLdrHeapAlloc(&g_Heap, cb);
     
    226224 * @param   cb      The requested heap block size.
    227225 */
    228 void *kldrHlpAllocZ(KSIZE cb)
     226KHLP_DECL(void *) kHlpAllocZ(KSIZE cb)
    229227{
    230228    void *pv = kLdrHeapAlloc(&g_Heap, cb);
    231229    if (pv)
    232         kLdrHlpMemSet(pv, 0, cb);
     230        kHlpMemSet(pv, 0, cb);
    233231    return pv;
    234232}
     
    238236 * Frees memory allocated off the kLdr heap.
    239237 *
    240  * @param   pv      Pointer to the heap block returned by kldrHlpAlloc().
    241  */
    242 void kldrHlpFree(void *pv)
     238 * @param   pv      Pointer to the heap block returned by kHlpAlloc().
     239 */
     240KHLP_DECL(void) kHlpFree(void *pv)
    243241{
    244242    kLdrHeapFree(&g_Heap, pv);
     
    252250 * @param   cb      The amount of memory.
    253251 */
    254 void kldrHlpHeapDonate(void *pv, KSIZE cb)
     252KHLP_DECL(void) kHlpHeapDonate(void *pv, KSIZE cb)
    255253{
    256254    kLdrHeapDonate(&g_Heap, pv, cb);
     
    652650static int kLdrHeapSegAlloc(PKLDRHEAPSEG pSeg, KSIZE cbMin)
    653651{
    654 #ifdef __OS2__
     652#if K_OS == K_OS_OS2
    655653    APIRET rc;
    656654
     
    667665    }
    668666
    669 #elif defined(__WIN__)
     667#elif  K_OS == K_OS_WINDOWS
    670668    pSeg->cb = (cbMin + 0xffff) & ~(KSIZE)0xffff;
    671669    pSeg->pvBase = VirtualAlloc(NULL, pSeg->cb, MEM_COMMIT, PAGE_READWRITE);
     
    691689static void kLdrHeapSegFree(PKLDRHEAPSEG pSeg)
    692690{
    693 #ifdef __OS2__
     691#if K_OS == K_OS_OS2
    694692    APIRET rc = DosFreeMem(pSeg->pvBase);
    695693    KLDRHEAP_ASSERT(!rc); (void)rc;
    696694
    697 #elif defined(__WIN__)
     695#elif  K_OS == K_OS_WINDOWS
    698696    BOOL fRc = VirtualFree(pSeg->pvBase, 0 /*pSeg->cb*/, MEM_RELEASE);
    699697    KLDRHEAP_ASSERT(fRc); (void)fRc;
  • trunk/kStuff/kHlp/Bare/kHlpBareMem.c

    r3571 r3573  
    11/* $Id$ */
    22/** @file
    3  *
    4  * kLdr - The Dynamic Loader, Memory Helper Functions.
    5  *
    6  * Copyright (c) 2006-2007 knut st. osmundsen <bird-kbuild-src@anduin.net>
    7  *
    8  *
    9  * This file is part of kLdr.
    10  *
    11  * kLdr is free software; you can redistribute it and/or modify
    12  * it under the terms of the GNU General Public License as published by
    13  * the Free Software Foundation; either version 2 of the License, or
    14  * (at your option) any later version.
    15  *
    16  * kLdr is distributed in the hope that it will be useful,
     3 * kHlp - Generic Page Memory Functions.
     4 */
     5
     6/*
     7 * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net>
     8 *
     9 * This file is part of kStuff.
     10 *
     11 * kStuff is free software; you can redistribute it and/or
     12 * modify it under the terms of the GNU Lesser General Public
     13 * License as published by the Free Software Foundation; either
     14 * version 2.1 of the License, or (at your option) any later version.
     15 *
     16 * kStuff is distributed in the hope that it will be useful,
    1717 * but WITHOUT ANY WARRANTY; without even the implied warranty of
    18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    19  * GNU General Public License for more details.
    20  *
    21  * You should have received a copy of the GNU General Public License
    22  * along with kLdr; if not, write to the Free Software
    23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    24  *
    25  */
    26 
     18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     19 * Lesser General Public License for more details.
     20 *
     21 * You should have received a copy of the GNU Lesser General Public
     22 * License along with kStuff; if not, write to the Free Software
     23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
     24 *
     25 */
    2726
    2827/*******************************************************************************
    2928*   Header Files                                                               *
    3029*******************************************************************************/
    31 #ifdef __OS2__
     30#include <k/kHlpAlloc.h>
     31
     32#if K_OS == K_OS_OS2
    3233# define INCL_BASE
    3334# define INCL_ERRORS
    3435# include <os2.h>
    35 #elif defined(__WIN__)
     36#elif  K_OS == K_OS_WINDOWS
    3637# include <Windows.h>
    3738#else
    3839# error "port me"
    3940#endif
    40 
    41 #include <k/kLdr.h>
    42 #include "kLdrHlp.h"
    4341
    4442
     
    4644*   Global Variables                                                           *
    4745*******************************************************************************/
    48 #ifdef __OS2__
     46#if K_OS == K_OS_OS2
    4947/** The base of the stub object.
    5048 * The OS/2 exe stub consists of a single data object. When allocating memory
     
    5452static KSIZE            g_cbStub = 0;
    5553
    56 #elif defined(__WIN__)
     54#elif  K_OS == K_OS_WINDOWS
    5755/** The system info. */
    5856static SYSTEM_INFO      g_SystemInfo;
     
    6361
    6462
    65 #ifdef __OS2__
    66 static ULONG kldrHlpPageProtToNative(KPROT enmProt)
     63#if K_OS == K_OS_OS2
     64static ULONG kHlpPageProtToNative(KPROT enmProt)
    6765{
    6866    switch (enmProt)
     
    7573        case KPROT_EXECUTE_READWRITE:    return PAG_COMMIT | PAG_EXECUTE | PAG_READ | PAG_WRITE;
    7674        default:
    77             kldrHlpAssert(0);
     75            kHlpAssert(0);
    7876            return ~0U;
    7977    }
    8078}
    81 #elif defined(__WIN__)
    82 static DWORD kldrHlpPageProtToNative(KPROT enmProt)
     79#elif  K_OS == K_OS_WINDOWS
     80static DWORD kHlpPageProtToNative(KPROT enmProt)
    8381{
    8482    switch (enmProt)
     
    9189        case KPROT_EXECUTE_READWRITE:    return PAGE_EXECUTE_READWRITE;
    9290        default:
    93             kldrHlpAssert(0);
     91            kHlpAssert(0);
    9492            return ~0U;
    9593    }
     
    107105 * @param   enmProt     The new protection. Copy-on-write is invalid.
    108106 */
    109 int     kldrHlpPageAlloc(void **ppv, KSIZE cb, KPROT enmProt, unsigned fFixed)
    110 {
    111 #ifdef __OS2__
     107KHLP_DECL(int) kHlpPageAlloc(void **ppv, KSIZE cb, KPROT enmProt, KBOOL fFixed)
     108{
     109#if K_OS == K_OS_OS2
    112110    APIRET  rc;
    113     ULONG   fFlags = kldrHlpPageProtToNative(enmProt);;
     111    ULONG   fFlags = kHlpPageProtToNative(enmProt);;
    114112
    115113    if (!fFixed)
     
    128126    if (!rc)
    129127        return 0;
    130     kldrHlpAssert(0);
    131     return rc;
    132 
    133 #elif defined(__WIN__)
     128    kHlpAssert(0);
     129    return rc;
     130
     131#elif  K_OS == K_OS_WINDOWS
    134132    /* (We don't have to care about the stub here, because the stub will be unmapped before we get here.) */
    135133    int     rc;
    136     DWORD   fProt = kldrHlpPageProtToNative(enmProt);
     134    DWORD   fProt = kHlpPageProtToNative(enmProt);
    137135
    138136    if (!g_SystemInfo.dwPageSize)
     
    143141        return 0;
    144142    rc = GetLastError();
    145     kldrHlpAssert(0);
     143    kHlpAssert(0);
    146144    return rc;
    147145
     
    155153 * Change the protection of one or more pages in an allocation.
    156154 *
    157  * (This will of course only work correctly on memory allocated by kldrHlpPageAlloc().)
     155 * (This will of course only work correctly on memory allocated by kHlpPageAlloc().)
    158156 *
    159157 * @returns 0 on success, non-zero OS status code on failure.
     
    162160 * @param   enmProt     The new protection. Copy-on-write is invalid.
    163161 */
    164 int     kldrHlpPageProtect(void *pv, KSIZE cb, KPROT enmProt)
    165 {
    166 #ifdef __OS2__
     162KHLP_DECL(int) kHlpPageProtect(void *pv, KSIZE cb, KPROT enmProt)
     163{
     164#if K_OS == K_OS_OS2
    167165    APIRET      rc;
    168     ULONG       fFlags = kldrHlpPageProtToNative(enmProt);;
     166    ULONG       fFlags = kHlpPageProtToNative(enmProt);;
    169167
    170168    /*
     
    188186        }
    189187    }
    190     kldrHlpAssert(!rc);
    191     return rc;
    192 
    193 #elif defined(__WIN__)
     188    kHlpAssert(!rc);
     189    return rc;
     190
     191#elif  K_OS == K_OS_WINDOWS
    194192    DWORD fOldProt = 0;
    195     DWORD fProt = kldrHlpPageProtToNative(enmProt);
     193    DWORD fProt = kHlpPageProtToNative(enmProt);
    196194    int rc = 0;
    197195
     
    199197    {
    200198        rc = GetLastError();
    201         kldrHlpAssert(0);
     199        kHlpAssert(0);
    202200    }
    203201    return rc;
     
    209207
    210208/**
    211  * Free memory allocated by kldrHlpPageAlloc().
     209 * Free memory allocated by kHlpPageAlloc().
    212210 *
    213211 * @returns 0 on success, non-zero OS status code on failure.
    214  * @param   pv          The address returned by kldrHlpPageAlloc().
    215  * @param   cb          The byte count requested from kldrHlpPageAlloc().
    216  */
    217 int     kldrHlpPageFree(void *pv, KSIZE cb)
    218 {
    219 #ifdef __OS2__
     212 * @param   pv          The address returned by kHlpPageAlloc().
     213 * @param   cb          The byte count requested from kHlpPageAlloc().
     214 */
     215KHLP_DECL(int) skHlpPageFree(void *pv, KSIZE cb)
     216{
     217#if K_OS == K_OS_OS2
    220218    APIRET rc;
    221219
     
    242240            if (rc)
    243241            {
    244                 kldrHlpAssert(!rc);
     242                kHlpAssert(!rc);
    245243                return rc;
    246244            }
     
    259257     */
    260258    rc = DosFreeMem(pv);
    261     kldrHlpAssert(!rc);
    262     return rc;
    263 
    264 #elif defined(__WIN__)
     259    kHlpAssert(!rc);
     260    return rc;
     261
     262#elif  K_OS == K_OS_WINDOWS
    265263    /*
    266264     * Free the object.
     
    270268    {
    271269        rc = GetLastError();
    272         kldrHlpAssert(0);
    273     }
    274     return rc;
    275 
    276 #else
    277 # error "port me"
    278 #endif
    279 }
    280 
     270        kHlpAssert(0);
     271    }
     272    return rc;
     273
     274#else
     275# error "port me"
     276#endif
     277}
     278
  • trunk/kStuff/kHlp/Bare/kHlpBarePath.c

    r3570 r3573  
    2929*   Header Files                                                               *
    3030*******************************************************************************/
    31 #include <k/kLdr.h>
    32 #include "kLdrHlp.h"
     31#include <k/kHlpPath.h>
     32#include <k/kHlpString.h>
    3333
    3434
     
    4040 * @param   pszFilename     The filename to parse.
    4141 */
    42 char   *kldrHlpGetFilename(const char *pszFilename)
     42char   *kHlpGetFilename(const char *pszFilename)
    4343{
    4444    const char *pszLast = NULL;
     
    7575 * @param   pszFilename     The filename to parse.
    7676 */
    77 char   *kldrHlpGetSuff(const char *pszFilename)
     77char   *kHlpGetSuff(const char *pszFilename)
    7878{
    7979    const char *pszDot = NULL;
    80     pszFilename = kldrHlpGetFilename(pszFilename);
     80    pszFilename = kHlpGetFilename(pszFilename);
    8181    for (;;)
    8282    {
     
    103103 * @param   pszFilename     The filename to parse.
    104104 */
    105 char   *kldrHlpGetExt(const char *pszFilename)
     105char   *kHlpGetExt(const char *pszFilename)
    106106{
    107     char *psz = kldrHlpGetSuff(pszFilename);
     107    char *psz = kHlpGetSuff(pszFilename);
    108108    return *psz ? psz + 1 : psz;
    109109}
     
    118118 * @param   pszFilename     The filename to parse.
    119119 */
    120 int kldrHlpIsFilenameOnly(const char *pszFilename)
     120int kHlpIsFilenameOnly(const char *pszFilename)
    121121{
    122122    for (;;)
  • trunk/kStuff/kHlp/Bare/kHlpBareSem.c

    r3570 r3573  
    2929*   Header Files                                                               *
    3030*******************************************************************************/
    31 #ifdef __OS2__
     31#include <k/kDefs.h>
     32#include <k/kHlpSem.h>
     33
     34#if K_OS == K_OS_OS2
    3235# define INCL_BASE
    3336# define INCL_ERRORS
    3437# include <os2.h>
    35 #elif defined(__WIN__)
     38#elif  K_OS == K_OS_WINDOWS
    3639# include <Windows.h>
    3740#else
     
    3942#endif
    4043
    41 #include <k/kLdr.h>
    42 #include "kLdrHlp.h"
    4344
    4445
     
    4647*   Global Variables                                                           *
    4748*******************************************************************************/
    48 #ifdef __OS2__
     49#if K_OS == K_OS_OS2
    4950/** The loader sempahore. */
    5051static HMTX             g_hmtx;
    5152
    52 #elif defined(__WIN__)
     53#elif  K_OS == K_OS_WINDOWS
    5354/** The loader sempahore. */
    5455static CRITICAL_SECTION g_CritSect;
     
    6364 * @returns 0 on success, non-zero OS status code on failure.
    6465 */
    65 int     kldrHlpSemInit(void)
     66int     kHlpSemInit(void)
    6667{
    67 #ifdef __OS2__
     68#if K_OS == K_OS_OS2
    6869    APIRET rc;
    6970    g_hmtx = NULLHANDLE;
     
    7273        return rc;
    7374
    74 #elif defined(__WIN__)
     75#elif  K_OS == K_OS_WINDOWS
    7576    InitializeCriticalSection(&g_CritSect);
    7677
     
    8586 * Terminates the loader semaphore.
    8687 */
    87 void    kldrHlpSemTerm(void)
     88void    kHlpSemTerm(void)
    8889{
    89 #ifdef __OS2__
     90#if K_OS == K_OS_OS2
    9091    HMTX hmtx = g_hmtx;
    9192    g_hmtx = NULLHANDLE;
    9293    DosCloseMutexSem(hmtx);
    9394
    94 #elif defined(__WIN__)
     95#elif  K_OS == K_OS_WINDOWS
    9596    DeleteCriticalSection(&g_CritSect);
    9697
     
    107108 * @returns 0 on success, non-zero OS status code on failure.
    108109 */
    109 int     kldrHlpSemRequest(void)
     110int     kHlpSemRequest(void)
    110111{
    111 #ifdef __OS2__
     112#if K_OS == K_OS_OS2
    112113    APIRET rc = DosRequestMutexSem(g_hmtx, 5000);
    113114    if (rc == ERROR_TIMEOUT || rc == ERROR_SEM_TIMEOUT || rc == ERROR_INTERRUPT)
     
    125126    return rc;
    126127
    127 #elif defined(__WIN__)
     128#elif  K_OS == K_OS_WINDOWS
    128129    EnterCriticalSection(&g_CritSect);
    129130    return 0;
     
    139140 * The caller is responsible for making sure it's the semaphore owner!
    140141 */
    141 void    kldrHlpSemRelease(void)
     142void    kHlpSemRelease(void)
    142143{
    143 #ifdef __OS2__
     144#if K_OS == K_OS_OS2
    144145    APIRET rc = DosReleaseMutexSem(g_hmtx);
    145     kldrHlpAssert(!rc); (void)rc;
     146    kHlpAssert(!rc); (void)rc;
    146147
    147 #elif defined(__WIN__)
     148#elif  K_OS == K_OS_WINDOWS
    148149    LeaveCriticalSection(&g_CritSect);
    149150
  • trunk/kStuff/kHlp/Bare/kHlpBareStr.c

    r3570 r3573  
    11/* $Id$ */
    22/** @file
     3 * kHlpBare - String Manipulation.
     4 */
     5
     6/*
     7 * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net>
    38 *
    4  * kLdr - The Dynamic Loader, String Helper Functions.
     9 * This file is part of kStuff.
    510 *
    6  * Copyright (c) 2006 knut st. osmundsen <bird-kbuild-src@anduin.net>
     11 * kStuff is free software; you can redistribute it and/or
     12 * modify it under the terms of the GNU Lesser General Public
     13 * License as published by the Free Software Foundation; either
     14 * version 2.1 of the License, or (at your option) any later version.
    715 *
     16 * kStuff is distributed in the hope that it will be useful,
     17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     19 * Lesser General Public License for more details.
    820 *
    9  * This file is part of kLdr.
    10  *
    11  * kLdr is free software; you can redistribute it and/or modify
    12  * it under the terms of the GNU General Public License as published by
    13  * the Free Software Foundation; either version 2 of the License, or
    14  * (at your option) any later version.
    15  *
    16  * kLdr is distributed in the hope that it will be useful,
    17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    19  * GNU General Public License for more details.
    20  *
    21  * You should have received a copy of the GNU General Public License
    22  * along with kLdr; if not, write to the Free Software
    23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     21 * You should have received a copy of the GNU Lesser General Public
     22 * License along with kStuff; if not, write to the Free Software
     23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
    2424 *
    2525 */
    26 
    2726
    2827/*******************************************************************************
    2928*   Header Files                                                               *
    3029*******************************************************************************/
    31 #include <k/kLdr.h>
    32 #include "kLdrHlp.h"
     30#include <k/kHlpString.h>
    3331
    3432
    35 /**
    36  * Converts an signed integer to an ascii string.
    37  *
    38  * @returns psz.
    39  * @param   psz         Pointer to the output buffer.
    40  * @param   cch         The size of the output buffer.
    41  * @param   lVal        The value.
    42  * @param   iBase       The base to format it. (2,8,10 or 16)
    43  */
    44 char *kldrHlpInt2Ascii(char *psz, KSIZE cch, long lVal, unsigned iBase)
    45 {
    46     static const char s_szDigits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
    47     char *pszRet = psz;
    48 
    49     if (cch >= (lVal < 0 ? 3U : 2U) && psz)
    50     {
    51         /* prefix */
    52         if (lVal < 0)
    53         {
    54             *psz++ = '-';
    55             cch--;
    56             lVal = -lVal;
    57         }
    58 
    59         /* the digits */
    60         do
    61         {
    62             *psz++ = s_szDigits[lVal % iBase];
    63             cch--;
    64             lVal /= iBase;
    65         } while (lVal && cch > 1);
    66 
    67         /* overflow indicator */
    68         if (lVal)
    69             psz[-1] = '+';
    70     }
    71     else if (!pszRet)
    72         return pszRet;
    73     else if (cch < 1 || !pszRet)
    74         return pszRet;
    75     else
    76         *psz++ = '+';
    77     *psz = '\0';
    78 
    79     return pszRet;
    80 }
    81 
    82 
    83 KSIZE  kLdrHlpStrNLen(const char *psz, KSIZE cchMax)
     33KSIZE  kHlpStrNLen(const char *psz, KSIZE cchMax)
    8434{
    8535    const char * const pszStart = psz;
     
    9040
    9141
    92 int     kLdrHlpMemIComp(const void *pv1, const void *pv2, KSIZE cb)
     42int     kHlpMemIComp(const void *pv1, const void *pv2, KSIZE cb)
    9343{
    9444    const KU8 *pb1 = (const KU8 *)pv1;
     
    11060
    11161
    112 int     kLdrHlpStrIComp(const char *pv1, const char *pv2)
     62int     kHlpStrIComp(const char *pv1, const char *pv2)
    11363{
    11464    const KU8 *pb1 = (const KU8 *)pv1;
     
    13282
    13383
    134 #ifdef kLdrHlpStrChr_needed
    135 char   *kLdrHlpStrChr(const char *psz, int ch)
     84#ifdef kHlpStrChr_needed
     85char   *kHlpStrChr(const char *psz, int ch)
    13686{
    13787    while (*psz)
     
    14696
    14797
    148 #ifdef kLdrHlpMemChr_needed
    149 void   *kLdrHlpMemChr(const void *pv, int ch, KSIZE cb)
     98#ifdef kHlpMemChr_needed
     99void   *kHlpMemChr(const void *pv, int ch, KSIZE cb)
    150100{
    151101    const KU8 *pb = (const KU8 *)pv;
     
    162112
    163113
    164 #ifdef kLdrHlpMemMove_needed
    165 void   *kLdrHlpMemMove(void *pv1, const void *pv2, KSIZE cb)
     114#ifdef kHlpMemMove_needed
     115void   *kHlpMemMove(void *pv1, const void *pv2, KSIZE cb)
    166116{
    167117    KU8            *pbDst = (KU8 *)pv1;
     
    177127
    178128
    179 #ifdef kLdrHlpStrNComp_needed
    180 int     kLdrHlpStrNComp(const char *psz1, const char *psz2, KSIZE cch)
     129#ifdef kHlpStrNComp_needed
     130int     kHlpStrNComp(const char *psz1, const char *psz2, KSIZE cch)
    181131{
    182132    while (cch-- > 0)
  • trunk/kStuff/kHlp/Makefile.kmk

    r3572 r3573  
    11# $Id$
    22## @file
    3 # kHlpCRT - The CRT Based Helper API.
     3# kHlp - The Helper API.
    44#
    55
     
    2525#
    2626
    27 DEPTH = ../../..
     27DEPTH = ../..
    2828include $(PATH_KBUILD)/header.kmk
     29
     30#
     31# kHlpBaseStatic
     32#
     33LIBRARIES += kHlpBaseStatic
     34kHlpBaseStatic_TEMPLATE = kStuffLIB
     35kHlpBaseStatic_SOURCES = \
     36        Generic/kHlpInt2Ascii.c \
     37        \
     38        Bare/kHlpBareAssert.c \
     39        Bare/kHlpBareHeap.c \
     40        Bare/kHlpBareEnv.c \
     41        Bare/kHlpBareMem.c \
     42        Bare/kHlpBarePath.c \
     43        Bare/kHlpBareProcess.c \
     44        Bare/kHlpBareSem.c \
     45        Bare/kHlpBareStr.c \
     46        Bare/kHlpBareThread.c \
    2947
    3048#
     
    3452kHlpCRTStatic_TEMPLATE = kStuffLIB
    3553kHlpCRTStatic_SOURCES = \
    36         kHlpCRTAlloc.cpp \
    37         kHlpCRTString.cpp \
     54        \
     55        CRT/kHlpCRTAlloc.cpp \
     56        CRT/kHlpCRTString.cpp \
    3857
    3958# Generate the rules
Note: See TracChangeset for help on using the changeset viewer.