1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
/*
* tclUnixInit.c --
*
* Contains the Unix-specific interpreter initialization functions.
*
* Copyright © 1995-1997 Sun Microsystems, Inc.
* Copyright © 1999 Scriptics Corporation.
* All rights reserved.
*/
#include "tclInt.h"
#ifdef HAVE_LANGINFO
# include <langinfo.h>
# ifdef __APPLE__
# if defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1030
/* Support for weakly importing nl_langinfo on Darwin. */
# define WEAK_IMPORT_NL_LANGINFO
extern char *nl_langinfo(nl_item) WEAK_IMPORT_ATTRIBUTE;
# endif
# endif
#endif
#include <sys/resource.h>
#if defined(__FreeBSD__) && defined(__GNUC__)
# include <floatingpoint.h>
#endif
#if defined(__bsdi__)
# include <sys/param.h>
|
<
<
<
<
<
<
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
/*
* tclUnixInit.c --
*
* Contains the Unix-specific interpreter initialization functions.
*
* Copyright © 1995-1997 Sun Microsystems, Inc.
* Copyright © 1999 Scriptics Corporation.
* All rights reserved.
*/
#include "tclInt.h"
#ifdef HAVE_LANGINFO
# include <langinfo.h>
#endif
#include <sys/resource.h>
#if defined(__FreeBSD__) && defined(__GNUC__)
# include <floatingpoint.h>
#endif
#if defined(__bsdi__)
# include <sys/param.h>
|
| ︙ | | | ︙ | |
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
|
{"zh_tw.big5", "big5"},
};
#ifdef HAVE_COREFOUNDATION
static int MacOSXGetLibraryPath(Tcl_Interp *interp,
int maxPathLen, char *tclLibPath);
#endif /* HAVE_COREFOUNDATION */
#if defined(__APPLE__) && (defined(TCL_LOAD_FROM_MEMORY) || ( \
defined(MAC_OS_X_VERSION_MIN_REQUIRED) && ( \
(TCL_THREADS && MAC_OS_X_VERSION_MIN_REQUIRED < 1030) || \
(defined(__LP64__) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050) || \
(defined(HAVE_COREFOUNDATION) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050)\
)))
/*
* Need to check Darwin release at runtime in tclUnixFCmd.c and tclLoadDyld.c:
* initialize release global at startup from uname().
*/
#define GET_DARWIN_RELEASE 1
MODULE_SCOPE long tclMacOSXDarwinRelease;
long tclMacOSXDarwinRelease = 0;
#endif
/*
*---------------------------------------------------------------------------
*
* TclpInitPlatform --
*
* Initialize all the platform-dependent things like signals and
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
310
311
312
313
314
315
316
317
318
319
320
321
322
323
|
{"zh_tw.big5", "big5"},
};
#ifdef HAVE_COREFOUNDATION
static int MacOSXGetLibraryPath(Tcl_Interp *interp,
int maxPathLen, char *tclLibPath);
#endif /* HAVE_COREFOUNDATION */
/*
*---------------------------------------------------------------------------
*
* TclpInitPlatform --
*
* Initialize all the platform-dependent things like signals and
|
| ︙ | | | ︙ | |
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
|
* In case the initial locale is not "C", ensure that the numeric
* processing is done in "C" locale regardless. This is needed because Tcl
* relies on routines like strtol/strtoul, but should not have locale dependent
* behavior.
*/
setlocale(LC_NUMERIC, "C");
#ifdef GET_DARWIN_RELEASE
{
struct utsname name;
if (!uname(&name)) {
tclMacOSXDarwinRelease = strtol(name.release, NULL, 10);
}
}
#endif
}
/*
*---------------------------------------------------------------------------
*
* TclpInitLibraryPath --
*
|
<
<
<
<
<
<
<
<
<
<
|
397
398
399
400
401
402
403
404
405
406
407
408
409
410
|
* In case the initial locale is not "C", ensure that the numeric
* processing is done in "C" locale regardless. This is needed because Tcl
* relies on routines like strtol/strtoul, but should not have locale dependent
* behavior.
*/
setlocale(LC_NUMERIC, "C");
}
/*
*---------------------------------------------------------------------------
*
* TclpInitLibraryPath --
*
|
| ︙ | | | ︙ | |
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
|
* Side effects:
* Sets "tclDefaultLibrary", "tcl_pkgPath", and "tcl_platform" Tcl
* variables.
*
*----------------------------------------------------------------------
*/
#if defined(HAVE_COREFOUNDATION) && MAC_OS_X_VERSION_MAX_ALLOWED > 1020
/*
* Helper because whether CFLocaleCopyCurrent and CFLocaleGetIdentifier are
* strongly or weakly bound varies by version of OSX, triggering warnings.
*/
static inline void
InitMacLocaleInfoVar(
|
|
|
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
|
* Side effects:
* Sets "tclDefaultLibrary", "tcl_pkgPath", and "tcl_platform" Tcl
* variables.
*
*----------------------------------------------------------------------
*/
#if defined(HAVE_COREFOUNDATION)
/*
* Helper because whether CFLocaleCopyCurrent and CFLocaleGetIdentifier are
* strongly or weakly bound varies by version of OSX, triggering warnings.
*/
static inline void
InitMacLocaleInfoVar(
|
| ︙ | | | ︙ | |
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
|
if (!Tcl_CreateNamespace(interp, "::tcl::mac", NULL, NULL)) {
Tcl_ResetResult(interp);
}
Tcl_SetVar2(interp, "::tcl::mac::locale", NULL, loc, TCL_GLOBAL_ONLY);
}
CFRelease(localeRef);
}
#endif /*defined(HAVE_COREFOUNDATION) && MAC_OS_X_VERSION_MAX_ALLOWED > 1020*/
void
TclpSetVariables(
Tcl_Interp *interp)
{
#ifdef __CYGWIN__
SYSTEM_INFO sysInfo;
|
|
|
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
|
if (!Tcl_CreateNamespace(interp, "::tcl::mac", NULL, NULL)) {
Tcl_ResetResult(interp);
}
Tcl_SetVar2(interp, "::tcl::mac::locale", NULL, loc, TCL_GLOBAL_ONLY);
}
CFRelease(localeRef);
}
#endif /*defined(HAVE_COREFOUNDATION)*/
void
TclpSetVariables(
Tcl_Interp *interp)
{
#ifdef __CYGWIN__
SYSTEM_INFO sysInfo;
|
| ︙ | | | ︙ | |
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
|
#ifdef HAVE_COREFOUNDATION
char tclLibPath[MAXPATHLEN + 1];
/*
* Set msgcat fallback locale to current CFLocale identifier.
*/
#if MAC_OS_X_VERSION_MAX_ALLOWED > 1020
InitMacLocaleInfoVar(CFLocaleCopyCurrent, CFLocaleGetIdentifier, interp);
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED > 1020 */
if (MacOSXGetLibraryPath(interp, MAXPATHLEN, tclLibPath) == TCL_OK) {
const char *str;
CFBundleRef bundleRef;
Tcl_DString ds;
Tcl_SetVar2(interp, "tclDefaultLibrary", NULL, tclLibPath, TCL_GLOBAL_ONLY);
|
<
<
|
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
|
#ifdef HAVE_COREFOUNDATION
char tclLibPath[MAXPATHLEN + 1];
/*
* Set msgcat fallback locale to current CFLocale identifier.
*/
InitMacLocaleInfoVar(CFLocaleCopyCurrent, CFLocaleGetIdentifier, interp);
if (MacOSXGetLibraryPath(interp, MAXPATHLEN, tclLibPath) == TCL_OK) {
const char *str;
CFBundleRef bundleRef;
Tcl_DString ds;
Tcl_SetVar2(interp, "tclDefaultLibrary", NULL, tclLibPath, TCL_GLOBAL_ONLY);
|
| ︙ | | | ︙ | |