From d79b05742443f8df4d50c496bc729dfd3c8cb57f Mon Sep 17 00:00:00 2001 From: MARS-NWE Patch Bot Date: Fri, 12 Jun 2026 16:24:31 +0000 Subject: [PATCH] core: import NSS Macintosh codepage name helper into libnwcore --- AI.md | 11 +++- src/core/CMakeLists.txt | 1 + src/core/getMacCodePageName.c | 95 +++++++++++++++++++++++++++++++++++ src/core/unicodeInit.c | 20 ++++++++ 4 files changed, 125 insertions(+), 2 deletions(-) create mode 100644 src/core/getMacCodePageName.c diff --git a/AI.md b/AI.md index 659218e..24c98d6 100644 --- a/AI.md +++ b/AI.md @@ -1,9 +1,9 @@ # AI working notes for mars-nwe -## Current handoff status after NSS low-level imports 0404-0416 +## Current handoff status after NSS low-level imports 0404-0417 Current accepted MARS-NWE server line in this work session includes the NSS -low-level libnwcore imports through `0416`: +low-level libnwcore imports through `0417`: - `0404` imports NSS `bitmap.c` directly as `src/core/bitmap.c`. - `0405` moves the imported bitmap/NSS base headers directly into @@ -63,6 +63,13 @@ low-level libnwcore imports through `0416`: introduced; any future table data still belongs in the external `mars-unicode-tables` submodule. +- `0417` imports NSS `getMacCodePageName.c` and fills out the remaining + lightweight Unicode init symbols (`LB_UnicodeStartup()`, + `LB_UnicodeShutdown()`, `MacintoshCodePageName`) needed by imported NSS + converter entry points. The Macintosh codepage name stays NULL until the + real codepage table/runtime layer is imported, so no new Unicode/codepage + tables are introduced in this patch. + Keep future NSS low-level imports directly under `src/core/.c` and `include/core/.h`. Do not add a new `nwcore/nss/` or `src/core/nss/` path for the active libnwcore imports. diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 6b10d8a..1836059 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -104,6 +104,7 @@ set(NWCORE_IMPORTED_NSS_SOURCES bitmap.c bit.c crc.c + getMacCodePageName.c getNssUnicodeVersion.c hash.c componentUnicpy.c diff --git a/src/core/getMacCodePageName.c b/src/core/getMacCodePageName.c new file mode 100644 index 0000000..1c0e4c4 --- /dev/null +++ b/src/core/getMacCodePageName.c @@ -0,0 +1,95 @@ +/**************************************************************************** + | + | (C) Copyright 1985, 1991, 1993, 1996 Novell, Inc. + | All Rights Reserved. + | + | This program is free software; you can redistribute it and/or + | modify it under the terms of version 2 of the GNU General Public + | License as published by the Free Software Foundation. + | + | This program is distributed in the hope that it will be useful, + | but WITHOUT ANY WARRANTY; without even the implied warranty of + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + | GNU General Public License for more details. + | + | You should have received a copy of the GNU General Public License + | along with this program; if not, contact Novell, Inc. + | + | To contact Novell about this file by physical or electronic mail, + | you may find current contact information at www.novell.com + | + |*************************************************************************** + | + | NetWare Advance File Services (NSS) module + | + |--------------------------------------------------------------------------- + | + | $Author: taysom $ + | $Date: 2004-12-31 01:10:58 +0530 (Fri, 31 Dec 2004) $ + | + | $RCSfile$ + | $Revision: 465 $ + | + |--------------------------------------------------------------------------- + | This module is used to: + | Routine to convert ascii to unicode_t + | + | 9/14/01: Instead of calling system routines for unicode conversion, NSS + | has created is own set of conversion functions that are MP safe and fast. ++-------------------------------------------------------------------------*/ +#if zLINUX +#include "nssOSAPIs.h" +#endif +#include +#include +#include +#include +#if zNETWARE +#include "nssOSAPIs.h" +#endif + + +/************************************************************************** + * + * This returns the ASCII name of the current Macintosh Code Page. + * + * Return Codes: + * zOK - The codepage name is returned in the buffer. + * zERR_NO_FILES_FOUND - The codepage name is empty or not initialized. + * zERR_BUFFER_TOO_SMALL - the buffer provided by the caller is not + * big enough to contain the code page name. + * + ***************************************************************************/ +STATUS LB_GetMacCodePageName( + BYTE *nameBuffer, /* Buffer into which the name will be put*/ + NINT bufferLen) /* Length of the buffer */ +{ + NINT nameLen; + + if (MacintoshCodePageName == NULL) + { + /* This is a silly error to return, but it implies that we did not + * fine a name for the Macintosh code page. That is all that is needed. + */ + return(zERR_NO_FILES_FOUND); + } + + nameLen = strlen(MacintoshCodePageName); + if (nameLen == 0) + { + /* This is a silly error to return, but it implies that we did not + * fine a name for the Macintosh code page. That is all that is needed. + */ + return(zERR_NO_FILES_FOUND); + } + else if (nameLen > (bufferLen-1)) + { + /* Not enough room in the caller's buffer to receive the name. */ + return(zERR_BUFFER_TOO_SMALL); + } + else + { + strcpy(nameBuffer, MacintoshCodePageName); + } + return zOK; +} diff --git a/src/core/unicodeInit.c b/src/core/unicodeInit.c index 8d76610..4a3c8ec 100644 --- a/src/core/unicodeInit.c +++ b/src/core/unicodeInit.c @@ -23,6 +23,7 @@ | MARS-NWE libnwcore Unicode case table bootstrap. +-------------------------------------------------------------------------*/ #include +#include /* * NSS stores the Unicode translation of byte 0xff in these globals for @@ -34,6 +35,15 @@ unicode_t NSSUnicodeFF = ASCII_WILDCARD_BREAK; unicode_t NSSUnicodeMacFF = ASCII_WILDCARD_BREAK; +/* + * Full NSS Unicode startup also tracks the active Macintosh codepage name. + * Keep the exported storage so LB_GetMacCodePageName() and future converter + * imports link; the value remains NULL until codepage tables/runtime are + * imported from the external unicode table source. + */ +BYTE *MacintoshCodePageName = NULL; + + /* * NSS normally fills NSSUniToLower[]/NSSUniToUpper[] during * LB_UnicodeStartup() in public_core/library/unicode/unicodeInit.c via the @@ -45,6 +55,16 @@ unicode_t NSSUnicodeMacFF = ASCII_WILDCARD_BREAK; * statically initialized by TAB/unicodeTables.c and therefore need no runtime * fill step here. */ +STATUS LB_UnicodeStartup(void) +{ + LB_UnicodeCaseStartup(); + return zOK; +} + +void LB_UnicodeShutdown(void) +{ +} + void LB_UnicodeCaseStartup(void) { }