SUMMARY:
CLIBC_16.LIB - Selected independent near model replacement functions from the standard C (Microsoft C/C++ 7.00) library. Distribution zip file includes sources, Makefile, and limited documentation.

DISTRIBUTION clibc_16.zip CONTENTS:

string\strcpy.asm
string\strlen.asm
string\skipsp.asm
string\skiptosp.asm
string\strcat.asm
string\strcmp.asm
string\strchr.asm
string\strstr.asm
string\strrchr.asm
string\stricmp.asm
string\skipspr.asm
string\skiptosr.asm
string\strlwr.asm
string\strupr.asm
string\strncpy.asm
string\strncat.asm
string\memmove.asm
string\memset.asm
string\memcmp.asm
string\Makefile
string\string.h
string\string.inc
misc\isspace.asm
misc\isalnum.asm
misc\isalpha.asm
misc\isascii.asm
misc\iscntrl.asm
misc\iscsym.asm
misc\iscsymf.asm
misc\isdigit.asm
misc\islower.asm
misc\isupper.asm
misc\isxdigit.asm
misc\Makefile
misc\misc.h
misc\misc.inc
test\testmod.asm
test\main.c
test\Makefile
clibc_16.inc
clibc_16.txt
Makefile
Makefile.g

BUILD THE LIBRARY:

UNZIP DISTRIBUTION
Pkzip 2.50 zipped/ compressed the library distribution file. To unzip the library, place the clibc_16.zip file into the desired directory.
pkunzip -d clibc_16.zip
creates and places above listed files/ directories into directory clibc_16
change to directory clibc_16

EDIT MAKEFILE
After unzipping the distribution package, edit Makefile.g (NOT Makefile) as required.
Configuration options requiring attention:

DIR_C_INCLUDE
Set to the location to copy the library C include (*.h) files into.  Note, these files will be placed into the clibc_16 subdirectory within DIR_C_INCLUDE. May be identical to DIR_ASM_INCLUDE. Do not include a trailing slash.

DIR_ASM_INCLUDE
Set to the location to copy the library MASM include (*.inc) files into.  Note, these files will be placed into the clibc_16 subdirectory within DIR_ASM_INCLUDE. May be identical to DIR_C_INCLUDE. Do not include a trailing slash.

DIRLIB
Set to the location to copy the library (clibc_16.lib) into. Do not include a trailing slash.

DEBUG= (1=DEBUG_YES, 0=DEBUG_NO)
Value of 1 builds debug (CodeView 4.10 DOS) version of library.

CLC16_C= (1=CLIBC_16_FARCALL, 0=CLIBC_16_NEARCALL)
Function may be called using __farcall, or __nearcall. To build the normal __near call functions (placed into the DGROUP(_TEXT) segment,) use CLIBC_16_NEARCALL (default). To build __farcall functions, based and placed into a separate segment (CLIBC_16), use CLIBC_16_FARCALL.

CLIBC_16_FN_FC_PTRS =(1=CLIBC_16_FN_PTRS_YES, 0=CLIBC_16_FN_PTRS_NO)
For applications wanting to call the same function using both the fastcall and normal __cdecl call conventions, creates global scope function pointers to each fastcall version of the function. The pointers are placed into the DGROUP(_DATA) segment. The pointer naming convention is as follows; The first part of the name is p_fn_fc_ and the suffix is the function name. Example p_fn_fc_isascii points to the fastcall version of the isascii function. Some functions may have more than one fastcall version. strstr, for example, has strstr (normal), strstr_sss (source offset from ss), and strstr_dss (destination offset from ss) versions, for a total of three. In cases where the function has multiple fastcall versions, the pointer is an array, with index 0 being the normal version, index 1 being the _sss version, and index 2 being the _dss version.
For applications not using the function pointers, and avoiding any global data added to _DATA segment, set to CLIBC_16_FN_PTRS_NO (default).

RUN NMAKE
Once the files are unziped, and the Makefile.g edited, run
NMAKE clean

Then run
NMAKE
to build and install the library

CLIBC_16.LIB BUILD TOOLS
The library is built (and debugged?) with the following Microsoft development tools:
NMAKE 1.30    (MSVC 1.0 distribution)
MASM 6.14     (MASM 6.11 distribution, updated with ML614.EXE Patch)
MSC/C++ 8.0   (MSVC 1.0 distribution)
LINK 5.50     (MSVC 1.0 distribution)
PWB 2.1.49    (C/C++ 7.0 distribution)
CODEVIEW 4.10 (MSVC 1.0 distribution)
LIB 3.31      (MSVC 1.0 distribution)

Note:
Most tools runs in a Windows9X DOS box.

DOCUMENTATION:
See the Run-Time Library Reference manual for each individual function. Except where noted, clibc_16.lib function parameters and return values are identical.

Some functions in clibc_16 have corresponding Microsoft intrinsic versions. To use the library, disabling automatic intrinsic substitution may be required in some cases.

All function parameters in clibc_16.lib use __near pointers. Each function has an run time library replacement for which all pointers (source and destination) are offset from ds. Each function with a source __near pointer has a _sss version, which indicates the source pointer is offset from ss (Sss). Each function with a destination __near pointer also has a _dss version, which indicates the destination pointer is offset from ss (Dss). Each function, where applicable, preserves the es register, for additional compatibility with assembly routines.

Most clibc_16 functions have corresponding __fastcall functions. In some cases, typically for the more compicated functions, the fastcall version requires more clock cycles then the normal version. In all cases, the fastcall versions save all registers except the return register ax (and dx for 4 byte return values where applicable).

GENERAL:
Independent means that each function included in clibc_16.lib is completely independent of any other function. Most C library functions are dependent on other library functions, computer hardware, BIOS, and may require initialization. Because each clibc_16.lib function is independent, no initialization is required, and each individual function may be included as required in an application. Programmers developing applications requiring independent functions should appreciate clibc_16.lib. Due to the independent nature of each function, only a subset of the standard C library may be implemented. As demand warrants, and/or as they are completed, and/or as they are donated, functions that may be implemented as independent will be added to clibc_16.lib. Contributions gladly accepted, especially sprintf and sscanf.

See clib_16.lib for far model independent functions.

APPLICATIONS/ USAGE
To link with the library, two defines are required prior to including the .h and/or .inc files.
CLC16_C= (1=CLIBC_16_FARCALL, 0=CLIBC_16_NEARCALL)
CLIBC_16_FN_FC_PTRS =(1=CLIBC_16_FN_PTRS_YES, 0=CLIBC_16_FN_PTRS_NO)

For C applications, these may be defined using #define prior to the .h file, or using the cl /D compiler option. For ASM applications, these may be defined using EQU prior to the .inc file, or using the ml /D compiler option.

Most important, is that they are set to the same values used when building the library!!!

EXAMPLE
#define CLC16_C 0
#define CLIBC_16_FN_PTRS 1
#include <clibc_16\string.h>

/* sets p_fc_strstr to strstr_dss (index 2 of possible 0,1,2) fastcall version */
P_FN_FC_STRSTR p_fc_strstr= (P_FN_FC_STRSTR) p_fn_fc_strstr[2];
char str[]="Four String";
..
..
/* call strstr_dss fastcall version (parameter pointers are correct iff ds==ss) */
(*p_fc_strstr)(str,"ing");

/* will call the normal (index 0 of possible 0,1) fastcall version of strlen. */
i = (*p_fn_fc_strlen[0])(str);
/* will call the normal (the only one) fastcall version of isascii */
i = (*p_fn_fc_isascii)('r');

CONTACT INFORMATION:

email:
bkyoung@cwnet.com

Address:
Byron Young
2351 Woodthrush Way
Pleasanton, CA 94566

COPYRIGHT INFORMATION:
All work, including, but not limited to, source files, make files, project organization, included herein the distribution are copyrighted by the author. Commercial use and commercial distribution of this library, or any portion, code, documentation, or files, without the prior written permission of the author is prohibited. Library may only be distributed for personal non commercial use in original zip format by the simtel network. This copyright information includes all legal interpretations, but intends to specifically prohibit using this library, without negotiating a separate liscense agreement with the author, as part of any commercial application that results in, either direct or indirect, net or gross financial gain by the commercial user.

DISCLAIMER
No warranty, expressed or implied, is given concerning the functionality or operability of the code included in this distribution. In fact, many code portions may require debugging.

BUGS
A project of this type will never be bug free. Writing simultaneous, almost identical functions, for two different models (near, far), and two calling conventions (cdecl, fastcall), with different pointer function bases always generates some confusion. Bug reports gladly accepted, and are appreciated.

A consistent "bug" concerns segment registers. Some function, to determine if two pointers are equal, directly compare segment registers. Applications using these functions that switch between real and protected mode must be certain that the segment registers are synced with the hidden registers after switching modes. Future versions may correct this 'bug".

CONTRIBUTORS
Just nobody.

REVISIONS
Release_04 10/14/2002 ilibc_04.zip
Test sources tests all clibc_16 functions.
All functions currently in library have corresponding fastcall versions.
Test sources now built with included test/Makefile
Added optional global pointers to fastcall functions.
Added __far( based) call or __near call options for function calls.
Adjusted copyright information.
Minor code fixes.

Release_03 09/24/2002 ilibc_03.zip
Major project reorganization; new source directories.
New Makefiles, added new configuration option.
Added .inc files, and separated .h files.
Created MSC7.0 RT library replacement functions.
Created functions with source (and destination) offset from ss.
Created fastcall versions of new functions.
Most new functions require debugging, focusing on segments.
Added test sources to project.

Release_02 09/14/2002 ilibc_02.zip
Fastcall functions debugged.
Numerous bug fixes in other functions.

09/04/2002 ilibc_01.zip
Initial Release.