зеркало из https://github.com/mozilla/gecko-dev.git
remove XP_MAC stuff from js. b=281889 r=brendan a=brendan
This commit is contained in:
Родитель
12842f1b14
Коммит
d9027016bd
|
@ -42,7 +42,6 @@
|
|||
#include "native.h"
|
||||
#include "jsdebug.h"
|
||||
|
||||
#ifndef XP_MAC
|
||||
#include "_gen/netscape_jsdebug_DebugController.h"
|
||||
#include "_gen/netscape_jsdebug_Script.h"
|
||||
#include "_gen/netscape_jsdebug_JSThreadState.h"
|
||||
|
@ -50,15 +49,6 @@
|
|||
#include "_gen/netscape_jsdebug_JSPC.h"
|
||||
#include "_gen/netscape_jsdebug_JSSourceTextProvider.h"
|
||||
#include "_gen/netscape_jsdebug_JSErrorReporter.h"
|
||||
#else
|
||||
#include "n_jsdebug_DebugController.h"
|
||||
#include "netscape_jsdebug_Script.h"
|
||||
#include "n_jsdebug_JSThreadState.h"
|
||||
#include "n_jsdebug_JSStackFrameInfo.h"
|
||||
#include "netscape_jsdebug_JSPC.h"
|
||||
#include "n_j_JSSourceTextProvider.h"
|
||||
#include "n_jsdebug_JSErrorReporter.h"
|
||||
#endif
|
||||
|
||||
static JSDContext* context = 0;
|
||||
static struct Hnetscape_jsdebug_DebugController* controller = 0;
|
||||
|
|
|
@ -39,20 +39,11 @@
|
|||
|
||||
#if 0
|
||||
|
||||
#ifndef XP_MAC
|
||||
#include "_stubs/netscape_jsdebug_Script.c"
|
||||
#include "_stubs/netscape_jsdebug_DebugController.c"
|
||||
#include "_stubs/netscape_jsdebug_JSThreadState.c"
|
||||
#include "_stubs/netscape_jsdebug_JSStackFrameInfo.c"
|
||||
#include "_stubs/netscape_jsdebug_JSPC.c"
|
||||
#include "_stubs/netscape_jsdebug_JSSourceTextProvider.c"
|
||||
#else
|
||||
#include "netscape_jsdebug_Script.c"
|
||||
#include "n_jsdebug_DebugController.c"
|
||||
#include "n_jsdebug_JSThreadState.c"
|
||||
#include "n_jsdebug_JSStackFrameInfo.c"
|
||||
#include "netscape_jsdebug_JSPC.c"
|
||||
#include "n_j_JSSourceTextProvider.c"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
174
js/src/js.c
174
js/src/js.c
|
@ -102,133 +102,6 @@ JSBool gQuitting = JS_FALSE;
|
|||
FILE *gErrFile = NULL;
|
||||
FILE *gOutFile = NULL;
|
||||
|
||||
#ifdef XP_MAC
|
||||
#if defined(MAC_TEST_HACK) || defined(XP_MAC_MPW)
|
||||
/* this is the data file that all Print strings will be echoed into */
|
||||
FILE *gTestResultFile = NULL;
|
||||
#define isatty(f) 0
|
||||
#else
|
||||
#define isatty(f) 1
|
||||
#endif
|
||||
|
||||
char *strdup(const char *str)
|
||||
{
|
||||
char *copy = (char *) malloc(strlen(str)+1);
|
||||
if (copy)
|
||||
strcpy(copy, str);
|
||||
return copy;
|
||||
}
|
||||
|
||||
#ifdef XP_MAC_MPW
|
||||
/* Macintosh MPW replacements for the ANSI routines. These translate LF's to CR's because
|
||||
the MPW libraries supplied by Metrowerks don't do that for some reason. */
|
||||
static void translateLFtoCR(char *str, int length)
|
||||
{
|
||||
char *limit = str + length;
|
||||
while (str != limit) {
|
||||
if (*str == '\n')
|
||||
*str = '\r';
|
||||
str++;
|
||||
}
|
||||
}
|
||||
|
||||
int fputc(int c, FILE *file)
|
||||
{
|
||||
char buffer = c;
|
||||
if (buffer == '\n')
|
||||
buffer = '\r';
|
||||
return fwrite(&buffer, 1, 1, file);
|
||||
}
|
||||
|
||||
int fputs(const char *s, FILE *file)
|
||||
{
|
||||
char buffer[4096];
|
||||
int n = strlen(s);
|
||||
int extra = 0;
|
||||
|
||||
while (n > sizeof buffer) {
|
||||
memcpy(buffer, s, sizeof buffer);
|
||||
translateLFtoCR(buffer, sizeof buffer);
|
||||
extra += fwrite(buffer, 1, sizeof buffer, file);
|
||||
n -= sizeof buffer;
|
||||
s += sizeof buffer;
|
||||
}
|
||||
memcpy(buffer, s, n);
|
||||
translateLFtoCR(buffer, n);
|
||||
return extra + fwrite(buffer, 1, n, file);
|
||||
}
|
||||
|
||||
int fprintf(FILE* file, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
char smallBuffer[4096];
|
||||
int n;
|
||||
int bufferSize = sizeof smallBuffer;
|
||||
char *buffer = smallBuffer;
|
||||
int result;
|
||||
|
||||
va_start(args, format);
|
||||
n = vsnprintf(buffer, bufferSize, format, args);
|
||||
va_end(args);
|
||||
while (n < 0) {
|
||||
if (buffer != smallBuffer)
|
||||
free(buffer);
|
||||
bufferSize <<= 1;
|
||||
buffer = malloc(bufferSize);
|
||||
if (!buffer) {
|
||||
JS_ASSERT(JS_FALSE);
|
||||
return 0;
|
||||
}
|
||||
va_start(args, format);
|
||||
n = vsnprintf(buffer, bufferSize, format, args);
|
||||
va_end(args);
|
||||
}
|
||||
translateLFtoCR(buffer, n);
|
||||
result = fwrite(buffer, 1, n, file);
|
||||
if (buffer != smallBuffer)
|
||||
free(buffer);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
#include <SIOUX.h>
|
||||
#include <MacTypes.h>
|
||||
|
||||
static char* mac_argv[] = { "js", NULL };
|
||||
|
||||
static void initConsole(StringPtr consoleName, const char* startupMessage, int *argc, char** *argv)
|
||||
{
|
||||
SIOUXSettings.autocloseonquit = true;
|
||||
SIOUXSettings.asktosaveonclose = false;
|
||||
/* SIOUXSettings.initializeTB = false;
|
||||
SIOUXSettings.showstatusline = true;*/
|
||||
puts(startupMessage);
|
||||
SIOUXSetTitle(consoleName);
|
||||
|
||||
/* set up a buffer for stderr (otherwise it's a pig). */
|
||||
setvbuf(stderr, (char *) malloc(BUFSIZ), _IOLBF, BUFSIZ);
|
||||
|
||||
*argc = 1;
|
||||
*argv = mac_argv;
|
||||
}
|
||||
|
||||
#ifdef LIVECONNECT
|
||||
/* Little hack to provide a default CLASSPATH on the Mac. */
|
||||
#define getenv(var) mac_getenv(var)
|
||||
static char* mac_getenv(const char* var)
|
||||
{
|
||||
if (strcmp(var, "CLASSPATH") == 0) {
|
||||
static char class_path[] = "liveconnect.jar";
|
||||
return class_path;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif /* LIVECONNECT */
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef JSDEBUGGER
|
||||
static JSDContext *_jsdc;
|
||||
#ifdef JSDEBUGGER_JAVA_UI
|
||||
|
@ -279,10 +152,6 @@ GetLine(JSContext *cx, char *bufp, FILE *file, const char *prompt) {
|
|||
char line[256];
|
||||
fprintf(gOutFile, prompt);
|
||||
fflush(gOutFile);
|
||||
#ifdef XP_MAC_MPW
|
||||
/* Print a CR after the prompt because MPW grabs the entire line when entering an interactive command */
|
||||
fputc('\n', gOutFile);
|
||||
#endif
|
||||
if (!fgets(line, sizeof line, file))
|
||||
return JS_FALSE;
|
||||
strcpy(bufp, line);
|
||||
|
@ -2412,45 +2281,6 @@ main(int argc, char **argv, char **envp)
|
|||
gErrFile = stderr;
|
||||
gOutFile = stdout;
|
||||
|
||||
#ifdef XP_MAC
|
||||
#ifndef XP_MAC_MPW
|
||||
initConsole("\pJavaScript Shell", "Welcome to js shell.", &argc, &argv);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MAC_TEST_HACK
|
||||
/*
|
||||
Open a file "testArgs.txt" and read each line into argc/argv.
|
||||
Re-direct all output to "results.txt"
|
||||
*/
|
||||
{
|
||||
char argText[256];
|
||||
FILE *f = fopen("testargs.txt", "r");
|
||||
if (f) {
|
||||
int maxArgs = 32; /* arbitrary max !!! */
|
||||
int argText_strlen;
|
||||
argc = 1;
|
||||
argv = malloc(sizeof(char *) * maxArgs);
|
||||
argv[0] = NULL;
|
||||
while (fgets(argText, 255, f)) {
|
||||
/* argText includes '\n' */
|
||||
argText_strlen = strlen(argText);
|
||||
argv[argc] = malloc(argText_strlen);
|
||||
strncpy(argv[argc], argText, argText_strlen - 1);
|
||||
argv[argc][argText_strlen - 1] = '\0';
|
||||
argc++;
|
||||
if (argc >= maxArgs)
|
||||
break;
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
gTestResultFile = fopen("results.txt", "w");
|
||||
}
|
||||
|
||||
gErrFile = gTestResultFile;
|
||||
gOutFile = gTestResultFile;
|
||||
#endif
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
|
@ -2555,10 +2385,6 @@ main(int argc, char **argv, char **envp)
|
|||
JSD_DebuggerOff(_jsdc);
|
||||
#endif /* JSDEBUGGER */
|
||||
|
||||
#ifdef MAC_TEST_HACK
|
||||
fclose(gTestResultFile);
|
||||
#endif
|
||||
|
||||
JS_DestroyContext(cx);
|
||||
JS_DestroyRuntime(rt);
|
||||
JS_ShutDown();
|
||||
|
|
|
@ -128,11 +128,6 @@ static JSFunctionSpec boolean_methods[] = {
|
|||
{0,0,0,0,0}
|
||||
};
|
||||
|
||||
#ifdef XP_MAC
|
||||
#undef Boolean
|
||||
#define Boolean js_Boolean
|
||||
#endif
|
||||
|
||||
static JSBool
|
||||
Boolean(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
|
|
|
@ -49,17 +49,10 @@
|
|||
#define INT64 PRInt64
|
||||
#else
|
||||
|
||||
#ifdef __MWERKS__
|
||||
#define XP_MAC 1
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
/* Generate cpucfg.h */
|
||||
#ifdef XP_MAC
|
||||
#include <Types.h>
|
||||
#define INT64 UnsignedWide
|
||||
#else
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#ifdef WIN32
|
||||
#if defined(__GNUC__)
|
||||
|
@ -77,7 +70,6 @@
|
|||
#define INT64 long long
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* CROSS_COMPILE */
|
||||
|
||||
|
|
|
@ -42,52 +42,7 @@
|
|||
|
||||
#include "jsosdep.h"
|
||||
|
||||
#ifdef XP_MAC
|
||||
#undef IS_LITTLE_ENDIAN
|
||||
#define IS_BIG_ENDIAN 1
|
||||
|
||||
#define JS_BYTES_PER_BYTE 1L
|
||||
#define JS_BYTES_PER_SHORT 2L
|
||||
#define JS_BYTES_PER_INT 4L
|
||||
#define JS_BYTES_PER_INT64 8L
|
||||
#define JS_BYTES_PER_LONG 4L
|
||||
#define JS_BYTES_PER_FLOAT 4L
|
||||
#define JS_BYTES_PER_DOUBLE 8L
|
||||
#define JS_BYTES_PER_WORD 4L
|
||||
#define JS_BYTES_PER_DWORD 8L
|
||||
|
||||
#define JS_BITS_PER_BYTE 8L
|
||||
#define JS_BITS_PER_SHORT 16L
|
||||
#define JS_BITS_PER_INT 32L
|
||||
#define JS_BITS_PER_INT64 64L
|
||||
#define JS_BITS_PER_LONG 32L
|
||||
#define JS_BITS_PER_FLOAT 32L
|
||||
#define JS_BITS_PER_DOUBLE 64L
|
||||
#define JS_BITS_PER_WORD 32L
|
||||
|
||||
#define JS_BITS_PER_BYTE_LOG2 3L
|
||||
#define JS_BITS_PER_SHORT_LOG2 4L
|
||||
#define JS_BITS_PER_INT_LOG2 5L
|
||||
#define JS_BITS_PER_INT64_LOG2 6L
|
||||
#define JS_BITS_PER_LONG_LOG2 5L
|
||||
#define JS_BITS_PER_FLOAT_LOG2 5L
|
||||
#define JS_BITS_PER_DOUBLE_LOG2 6L
|
||||
#define JS_BITS_PER_WORD_LOG2 5L
|
||||
|
||||
#define JS_ALIGN_OF_SHORT 2L
|
||||
#define JS_ALIGN_OF_INT 4L
|
||||
#define JS_ALIGN_OF_LONG 4L
|
||||
#define JS_ALIGN_OF_INT64 2L
|
||||
#define JS_ALIGN_OF_FLOAT 4L
|
||||
#define JS_ALIGN_OF_DOUBLE 4L
|
||||
#define JS_ALIGN_OF_POINTER 4L
|
||||
#define JS_ALIGN_OF_WORD 4L
|
||||
|
||||
#define JS_BYTES_PER_WORD_LOG2 2L
|
||||
#define JS_BYTES_PER_DWORD_LOG2 3L
|
||||
#define PR_WORDS_PER_DWORD_LOG2 1L
|
||||
|
||||
#elif defined(XP_WIN) || defined(XP_OS2) || defined(WINCE)
|
||||
#if defined(XP_WIN) || defined(XP_OS2) || defined(WINCE)
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
#define HAVE_VA_LIST_AS_ARRAY
|
||||
|
@ -193,7 +148,7 @@
|
|||
|
||||
#else
|
||||
|
||||
#error "Must define one of XP_BEOS, XP_MAC, XP_OS2, XP_WIN, or XP_UNIX"
|
||||
#error "Must define one of XP_BEOS, XP_OS2, XP_WIN, or XP_UNIX"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -45,12 +45,7 @@
|
|||
#include "jsstddef.h"
|
||||
|
||||
/* ----------------- Platform-specific includes and defines ----------------- */
|
||||
#ifdef XP_MAC
|
||||
# define FILESEPARATOR ':'
|
||||
# define FILESEPARATOR2 '\0'
|
||||
# define CURRENT_DIR "HARD DISK:Desktop Folder"
|
||||
/* TODO: #include <???> */
|
||||
#elif defined(XP_WIN) || defined(XP_OS2)
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
# include <direct.h>
|
||||
# include <io.h>
|
||||
# include <sys/types.h>
|
||||
|
@ -253,14 +248,9 @@ static JSBool file_close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
static JSBool
|
||||
js_filenameHasAPipe(const char *filename)
|
||||
{
|
||||
#ifdef XP_MAC
|
||||
/* pipes are not supported on the MAC */
|
||||
return JS_FALSE;
|
||||
#else
|
||||
if(!filename) return JS_FALSE;
|
||||
return filename[0]==PIPE_SYMBOL ||
|
||||
filename[strlen(filename)-1]==PIPE_SYMBOL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -2040,9 +2030,6 @@ js_NewFileObjectFromFILE(JSContext *cx, FILE *nativehandle, char *filename,
|
|||
{
|
||||
JSObject *obj;
|
||||
JSFile *file;
|
||||
#ifdef XP_MAC
|
||||
JS_ReportWarning(cx, "Native files are not fully supported on the MAC");
|
||||
#endif
|
||||
|
||||
obj = JS_NewObject(cx, &file_class, NULL, NULL);
|
||||
if (!obj){
|
||||
|
|
|
@ -37,11 +37,6 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* build on macs with low memory */
|
||||
#if defined(XP_MAC) && defined(MOZ_MAC_LOWMEM)
|
||||
#pragma optimization_level 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* JavaScript bytecode interpreter.
|
||||
*/
|
||||
|
|
|
@ -129,10 +129,6 @@ math_asin(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
|
||||
if (!js_ValueToNumber(cx, argv[0], &x))
|
||||
return JS_FALSE;
|
||||
#ifdef XP_MAC
|
||||
if (x == 0)
|
||||
return js_NewNumberValue(cx, x, rval);
|
||||
#endif
|
||||
z = fd_asin(x);
|
||||
return js_NewNumberValue(cx, z, rval);
|
||||
}
|
||||
|
@ -144,10 +140,6 @@ math_atan(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
|
||||
if (!js_ValueToNumber(cx, argv[0], &x))
|
||||
return JS_FALSE;
|
||||
#ifdef XP_MAC
|
||||
if (x == 0)
|
||||
return js_NewNumberValue(cx, x, rval);
|
||||
#endif
|
||||
z = fd_atan(x);
|
||||
return js_NewNumberValue(cx, z, rval);
|
||||
}
|
||||
|
|
|
@ -77,10 +77,6 @@ js_DropProperty(JSContext *cx, JSObject *obj, JSProperty *prop);
|
|||
#define NATIVE_DROP_PROPERTY NULL
|
||||
#endif
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma export on
|
||||
#endif
|
||||
|
||||
JS_FRIEND_DATA(JSObjectOps) js_ObjectOps = {
|
||||
js_NewObjectMap, js_DestroyObjectMap,
|
||||
js_LookupProperty, js_DefineProperty,
|
||||
|
@ -96,10 +92,6 @@ JS_FRIEND_DATA(JSObjectOps) js_ObjectOps = {
|
|||
js_GetRequiredSlot, js_SetRequiredSlot
|
||||
};
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma export off
|
||||
#endif
|
||||
|
||||
JSClass js_ObjectClass = {
|
||||
js_Object_str,
|
||||
0,
|
||||
|
|
|
@ -52,21 +52,6 @@
|
|||
#endif
|
||||
#endif /* XP_WIN || XP_OS2 */
|
||||
|
||||
#ifdef XP_MAC
|
||||
#define JS_HAVE_LONG_LONG
|
||||
|
||||
JS_BEGIN_EXTERN_C
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
extern void* reallocSmaller(void* block, size_t newSize);
|
||||
|
||||
extern char* strdup(const char* str);
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
||||
#endif /* XP_MAC */
|
||||
|
||||
#ifdef XP_BEOS
|
||||
#define JS_HAVE_LONG_LONG
|
||||
#endif
|
||||
|
|
|
@ -75,7 +75,7 @@ typedef JSUintn uint;
|
|||
|
||||
typedef JSUintn uintn;
|
||||
typedef JSUint64 uint64;
|
||||
#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2)
|
||||
#if !defined(_WIN32) && !defined(XP_OS2)
|
||||
typedef JSUint32 uint32;
|
||||
#else
|
||||
typedef unsigned long uint32;
|
||||
|
@ -102,7 +102,7 @@ typedef JSInt64 int64;
|
|||
#ifdef HPUX
|
||||
#include <model.h>
|
||||
#else
|
||||
#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2)
|
||||
#if !defined(_WIN32) && !defined(XP_OS2)
|
||||
typedef JSInt32 int32;
|
||||
#else
|
||||
typedef long int32;
|
||||
|
@ -199,13 +199,4 @@ typedef JSFloat64 float64;
|
|||
#define PR_CompareStrings PL_CompareStrings
|
||||
#define PR_CompareValues PL_CompareValues
|
||||
|
||||
#ifdef XP_MAC
|
||||
#ifndef TRUE /* Mac standard is lower case true */
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE /* Mac standard is lower case false */
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* !defined(PROTYPES_H) */
|
||||
|
|
|
@ -63,10 +63,6 @@
|
|||
#include "jsscan.h"
|
||||
#include "jsstr.h"
|
||||
|
||||
#ifdef XP_MAC
|
||||
#include <MacMemory.h>
|
||||
#endif
|
||||
|
||||
#if JS_HAS_REGEXPS
|
||||
|
||||
/* Note : contiguity of 'simple opcodes' is important for SimpleMatch() */
|
||||
|
|
|
@ -107,15 +107,6 @@
|
|||
#define JS_STATIC_DLL_CALLBACK(__x) __x JS_DLL_CALLBACK
|
||||
#endif /* _WINDLL */
|
||||
|
||||
#elif defined(XP_MAC)
|
||||
#define JS_EXTERN_API(__type) extern __declspec(export) __type
|
||||
#define JS_EXPORT_API(__type) __declspec(export) __type
|
||||
#define JS_EXTERN_DATA(__type) extern __declspec(export) __type
|
||||
#define JS_EXPORT_DATA(__type) __declspec(export) __type
|
||||
|
||||
#define JS_DLL_CALLBACK
|
||||
#define JS_STATIC_DLL_CALLBACK(__x) static __x
|
||||
|
||||
#else /* Unix */
|
||||
|
||||
#ifdef HAVE_VISIBILITY_PRAGMA
|
||||
|
@ -234,13 +225,13 @@
|
|||
#define JS_MIN(x,y) ((x)<(y)?(x):(y))
|
||||
#define JS_MAX(x,y) ((x)>(y)?(x):(y))
|
||||
|
||||
#if ((defined(XP_MAC) || defined(XP_WIN)) && !defined(CROSS_COMPILE)) || defined (WINCE)
|
||||
#if (defined(XP_WIN) && !defined(CROSS_COMPILE)) || defined (WINCE)
|
||||
# include "jscpucfg.h" /* Use standard Mac or Windows configuration */
|
||||
#elif defined(XP_UNIX) || defined(XP_BEOS) || defined(XP_OS2) || defined(CROSS_COMPILE)
|
||||
# include "jsautocfg.h" /* Use auto-detected configuration */
|
||||
# include "jsosdep.h" /* ...and platform-specific flags */
|
||||
#else
|
||||
# error "Must define one of XP_BEOS, XP_MAC, XP_OS2, XP_WIN or XP_UNIX"
|
||||
# error "Must define one of XP_BEOS, XP_OS2, XP_WIN or XP_UNIX"
|
||||
#endif
|
||||
|
||||
JS_BEGIN_EXTERN_C
|
||||
|
|
|
@ -51,109 +51,16 @@
|
|||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef XP_MAC
|
||||
# include <Types.h>
|
||||
# include <stdarg.h>
|
||||
# include "jsprf.h"
|
||||
#endif
|
||||
|
||||
#ifdef XP_MAC
|
||||
/*
|
||||
* PStrFromCStr converts the source C string to a destination
|
||||
* pascal string as it copies. The dest string will
|
||||
* be truncated to fit into an Str255 if necessary.
|
||||
* If the C String pointer is NULL, the pascal string's length is
|
||||
* set to zero.
|
||||
*/
|
||||
static void PStrFromCStr(const char *src, Str255 dst)
|
||||
{
|
||||
short length = 0;
|
||||
|
||||
/* handle case of overlapping strings */
|
||||
if ( (void*)src == (void*)dst )
|
||||
{
|
||||
unsigned char *curdst = &dst[1];
|
||||
unsigned char thisChar;
|
||||
|
||||
thisChar = *(const unsigned char*)src++;
|
||||
while ( thisChar != '\0' )
|
||||
{
|
||||
unsigned char nextChar;
|
||||
|
||||
/*
|
||||
* Use nextChar so we don't overwrite what we
|
||||
* are about to read
|
||||
*/
|
||||
nextChar = *(const unsigned char*)src++;
|
||||
*curdst++ = thisChar;
|
||||
thisChar = nextChar;
|
||||
|
||||
if ( ++length >= 255 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ( src != NULL )
|
||||
{
|
||||
unsigned char *curdst = &dst[1];
|
||||
/* count down so test it loop is faster */
|
||||
short overflow = 255;
|
||||
register char temp;
|
||||
|
||||
/*
|
||||
* Can't do the K&R C thing of while (*s++ = *t++)
|
||||
* because it will copy trailing zero which might
|
||||
* overrun pascal buffer. Instead we use a temp variable.
|
||||
*/
|
||||
while ( (temp = *src++) != 0 )
|
||||
{
|
||||
*(char*)curdst++ = temp;
|
||||
|
||||
if ( --overflow <= 0 )
|
||||
break;
|
||||
}
|
||||
length = 255 - overflow;
|
||||
}
|
||||
dst[0] = length;
|
||||
}
|
||||
|
||||
static void jsdebugstr(const char *debuggerMsg)
|
||||
{
|
||||
Str255 pStr;
|
||||
|
||||
PStrFromCStr(debuggerMsg, pStr);
|
||||
DebugStr(pStr);
|
||||
}
|
||||
|
||||
static void dprintf(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *buffer;
|
||||
|
||||
va_start(ap, format);
|
||||
buffer = (char *)JS_vsmprintf(format, ap);
|
||||
va_end(ap);
|
||||
|
||||
jsdebugstr(buffer);
|
||||
JS_smprintf_free(buffer);
|
||||
}
|
||||
#endif /* XP_MAC */
|
||||
|
||||
JS_PUBLIC_API(void) JS_Assert(const char *s, const char *file, JSIntn ln)
|
||||
{
|
||||
#ifdef XP_MAC
|
||||
dprintf("Assertion failure: %s, at %s:%d\n", s, file, ln);
|
||||
#else
|
||||
fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln);
|
||||
#endif
|
||||
#if defined(WIN32)
|
||||
DebugBreak();
|
||||
#endif
|
||||
#if defined(XP_OS2)
|
||||
asm("int $3");
|
||||
#endif
|
||||
#ifndef XP_MAC
|
||||
abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined DEBUG_notme && defined XP_UNIX
|
||||
|
|
|
@ -306,7 +306,7 @@ init_java_VM_reflection(JSJavaVM *jsjava_vm, JNIEnv *jEnv)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
#if defined(XP_MAC) || !defined(OJI)
|
||||
#if !defined(OJI)
|
||||
|
||||
/**
|
||||
* Workaround for the fact that MRJ loads a different instance of the shared library.
|
||||
|
@ -359,7 +359,7 @@ init_netscape_java_classes(JSJavaVM *jsjava_vm, JNIEnv *jEnv)
|
|||
LOAD_CLASS(netscape/javascript/JSException, njJSException);
|
||||
LOAD_CLASS(netscape/javascript/JSUtil, njJSUtil);
|
||||
|
||||
#if defined(XP_MAC) || !defined(OJI)
|
||||
#if !defined(OJI)
|
||||
JSObject_RegisterNativeMethods(jEnv);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -850,10 +850,6 @@ jsj_get_jlObject_descriptor(JSContext *cx, JNIEnv *jEnv)
|
|||
|
||||
/****************** Implementation of methods of JSObject *******************/
|
||||
|
||||
#ifdef XP_MAC
|
||||
#pragma export on
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Class: netscape_javascript_JSObject
|
||||
* Method: initClass
|
||||
|
|
|
@ -384,77 +384,6 @@ conversion_error:
|
|||
java_value->member_name = member_name; \
|
||||
}
|
||||
|
||||
#if XP_MAC
|
||||
|
||||
/* on MRJ jlong is typedef'd to wide, which is a struct. */
|
||||
#include <Math64.h>
|
||||
|
||||
static jsint jlong_to_jsint(jlong lvalue)
|
||||
{
|
||||
SInt64 val = WideToSInt64(lvalue);
|
||||
return S32Set(val);
|
||||
}
|
||||
|
||||
static jlong jsint_to_jlong(jsint ivalue)
|
||||
{
|
||||
SInt64 val = S64Set(ivalue);
|
||||
wide wval =SInt64ToWide(val);
|
||||
return *(jlong*)&wval;
|
||||
}
|
||||
|
||||
static jdouble jlong_to_jdouble(jlong lvalue)
|
||||
{
|
||||
SInt64 val = WideToSInt64(lvalue);
|
||||
return SInt64ToLongDouble(val);
|
||||
}
|
||||
|
||||
static jlong jdouble_to_jlong(jdouble dvalue)
|
||||
{
|
||||
SInt64 val = LongDoubleToSInt64(dvalue);
|
||||
wide wval = SInt64ToWide(val);
|
||||
return *(jlong*)&wval;
|
||||
}
|
||||
|
||||
/* Mac utility macro for jsj_ConvertJSValueToJavaValue(), below */
|
||||
#define JSVAL_TO_JLONG_JVALUE(member_name, member_type, jsvalue, java_value) \
|
||||
if (!JSVAL_IS_NUMBER(jsvalue)) { \
|
||||
if (!JS_ConvertValue(cx, jsvalue, JSTYPE_NUMBER, &jsvalue)) \
|
||||
goto conversion_error; \
|
||||
(*cost)++; \
|
||||
} \
|
||||
{ \
|
||||
member_type member_name; \
|
||||
\
|
||||
if (JSVAL_IS_INT(jsvalue)) { \
|
||||
jsint ival = JSVAL_TO_INT(jsvalue); \
|
||||
member_name = jsint_to_jlong(ival); \
|
||||
\
|
||||
} else { \
|
||||
jdouble dval = *JSVAL_TO_DOUBLE(jsvalue); \
|
||||
\
|
||||
/* NaN becomes zero when converted to integral value */ \
|
||||
if (JSDOUBLE_IS_NaN(dval)) \
|
||||
goto numeric_conversion_error; \
|
||||
\
|
||||
/* Unrepresentably large numbers, including infinities, */ \
|
||||
/* cause an error. */ \
|
||||
else if ((dval >= member_type ## _MAX_VALUE + 1) || \
|
||||
(dval <= member_type ## _MIN_VALUE - 1)) { \
|
||||
goto numeric_conversion_error; \
|
||||
} else \
|
||||
member_name = jdouble_to_jlong(dval); \
|
||||
\
|
||||
/* Don't allow a non-integral number to be converted \
|
||||
to an integral type */ \
|
||||
/* Actually, we have to allow this for LC1 compatibility */ \
|
||||
/*if (jlong_to_jdouble(member_name) != dval) \
|
||||
(*cost)++;*/ \
|
||||
} \
|
||||
if (java_value) \
|
||||
java_value->member_name = member_name; \
|
||||
}
|
||||
|
||||
#else
|
||||
#ifdef XP_OS2
|
||||
|
||||
/* OS2 utility macro for jsj_ConvertJSValueToJavaValue(), below */
|
||||
|
@ -508,7 +437,6 @@ static jdouble jlong_to_jdouble(jlong lvalue)
|
|||
|
||||
#define jlong_to_jdouble(lvalue) ((jdouble) lvalue)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -573,7 +501,7 @@ jsj_ConvertJSValueToJavaValue(JSContext *cx, JNIEnv *jEnv, jsval v_arg,
|
|||
break;
|
||||
|
||||
case JAVA_SIGNATURE_LONG:
|
||||
#if defined(XP_MAC) || (defined(XP_OS2) && !defined(HAVE_LONG_LONG))
|
||||
#if (defined(XP_OS2) && !defined(HAVE_LONG_LONG))
|
||||
JSVAL_TO_JLONG_JVALUE(j, jlong, v, java_value);
|
||||
#else
|
||||
JSVAL_TO_INTEGRAL_JVALUE(long, j, jlong, v, java_value);
|
||||
|
|
|
@ -74,40 +74,24 @@
|
|||
static void *
|
||||
DefaultAllocTable(void *pool, size_t size)
|
||||
{
|
||||
#if defined(XP_MAC)
|
||||
#pragma unused (pool)
|
||||
#endif
|
||||
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
static void
|
||||
DefaultFreeTable(void *pool, void *item)
|
||||
{
|
||||
#if defined(XP_MAC)
|
||||
#pragma unused (pool)
|
||||
#endif
|
||||
|
||||
free(item);
|
||||
}
|
||||
|
||||
static JSJHashEntry *
|
||||
DefaultAllocEntry(void *pool, const void *key)
|
||||
{
|
||||
#if defined(XP_MAC)
|
||||
#pragma unused (pool,key)
|
||||
#endif
|
||||
|
||||
return malloc(sizeof(JSJHashEntry));
|
||||
}
|
||||
|
||||
static void
|
||||
DefaultFreeEntry(void *pool, JSJHashEntry *he, JSUintn flag)
|
||||
{
|
||||
#if defined(XP_MAC)
|
||||
#pragma unused (pool)
|
||||
#endif
|
||||
|
||||
if (flag == HT_FREE_ENTRY)
|
||||
free(he);
|
||||
}
|
||||
|
|
|
@ -63,11 +63,6 @@
|
|||
# include "jsutil.h"
|
||||
# include "jshash.h"
|
||||
|
||||
#ifdef XP_MAC
|
||||
/* #include "macstdlibextras.h" *//* for strdup() */
|
||||
extern char* strdup(const char* str);
|
||||
#endif
|
||||
|
||||
#include "jsj_hash.h" /* Hash tables */
|
||||
#include "jni.h" /* Java Native Interface */
|
||||
#include "jsapi.h" /* JavaScript engine API */
|
||||
|
|
|
@ -97,7 +97,7 @@ default_create_java_vm(SystemJavaVM* *jvm, JNIEnv* *initialEnv, void* initargs)
|
|||
|
||||
/* Prepend the classpath argument to the default JVM classpath */
|
||||
if (user_classpath) {
|
||||
#if defined(XP_UNIX) || defined(XP_BEOS) || defined(XP_MAC)
|
||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
||||
full_classpath = JS_smprintf("%s:%s", user_classpath, vm_args.classpath);
|
||||
#else
|
||||
full_classpath = JS_smprintf("%s;%s", user_classpath, vm_args.classpath);
|
||||
|
|
|
@ -62,19 +62,6 @@
|
|||
#include <winbase.h>
|
||||
#endif
|
||||
|
||||
#ifdef XP_MAC
|
||||
#include <OSUtils.h>
|
||||
#include <TextUtils.h>
|
||||
#include <Resources.h>
|
||||
#include <Timer.h>
|
||||
#include <UTCUtils.h>
|
||||
#include <Power.h>
|
||||
#include <CodeFragments.h>
|
||||
#if !TARGET_CARBON
|
||||
#include <Traps.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
||||
|
||||
#ifdef _SVID_GETTOD /* Defined only on Solaris, see Solaris <sys/types.h> */
|
||||
|
@ -85,128 +72,6 @@ extern int gettimeofday(struct timeval *tv);
|
|||
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
#ifdef XP_MAC
|
||||
static uint64 dstLocalBaseMicroseconds;
|
||||
static unsigned long gJanuaryFirst1970Seconds;
|
||||
|
||||
static void MacintoshInitializeTime(void)
|
||||
{
|
||||
uint64 upTime;
|
||||
unsigned long currentLocalTimeSeconds,
|
||||
startupTimeSeconds;
|
||||
uint64 startupTimeMicroSeconds;
|
||||
uint32 upTimeSeconds;
|
||||
uint64 oneMillion, upTimeSecondsLong, microSecondsToSeconds;
|
||||
DateTimeRec firstSecondOfUnixTime;
|
||||
|
||||
/*
|
||||
* Figure out in local time what time the machine started up. This information can be added to
|
||||
* upTime to figure out the current local time as well as GMT.
|
||||
*/
|
||||
|
||||
Microseconds((UnsignedWide*)&upTime);
|
||||
|
||||
GetDateTime(¤tLocalTimeSeconds);
|
||||
|
||||
JSLL_I2L(microSecondsToSeconds, PRMJ_USEC_PER_SEC);
|
||||
JSLL_DIV(upTimeSecondsLong, upTime, microSecondsToSeconds);
|
||||
JSLL_L2I(upTimeSeconds, upTimeSecondsLong);
|
||||
|
||||
startupTimeSeconds = currentLocalTimeSeconds - upTimeSeconds;
|
||||
|
||||
/* Make sure that we normalize the macintosh base seconds to the unix base of January 1, 1970.
|
||||
*/
|
||||
|
||||
firstSecondOfUnixTime.year = 1970;
|
||||
firstSecondOfUnixTime.month = 1;
|
||||
firstSecondOfUnixTime.day = 1;
|
||||
firstSecondOfUnixTime.hour = 0;
|
||||
firstSecondOfUnixTime.minute = 0;
|
||||
firstSecondOfUnixTime.second = 0;
|
||||
firstSecondOfUnixTime.dayOfWeek = 0;
|
||||
|
||||
DateToSeconds(&firstSecondOfUnixTime, &gJanuaryFirst1970Seconds);
|
||||
|
||||
startupTimeSeconds -= gJanuaryFirst1970Seconds;
|
||||
|
||||
/* Now convert the startup time into a wide so that we can figure out GMT and DST.
|
||||
*/
|
||||
|
||||
JSLL_I2L(startupTimeMicroSeconds, startupTimeSeconds);
|
||||
JSLL_I2L(oneMillion, PRMJ_USEC_PER_SEC);
|
||||
JSLL_MUL(dstLocalBaseMicroseconds, oneMillion, startupTimeMicroSeconds);
|
||||
}
|
||||
|
||||
static SleepQRec gSleepQEntry = { NULL, sleepQType, NULL, 0 };
|
||||
static JSBool gSleepQEntryInstalled = JS_FALSE;
|
||||
|
||||
static pascal long MySleepQProc(long message, SleepQRecPtr sleepQ)
|
||||
{
|
||||
/* just woke up from sleeping, so must recompute dstLocalBaseMicroseconds. */
|
||||
if (message == kSleepWakeUp)
|
||||
MacintoshInitializeTime();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Because serial port and SLIP conflict with ReadXPram calls,
|
||||
* we cache the call here
|
||||
*/
|
||||
|
||||
static void MyReadLocation(MachineLocation * loc)
|
||||
{
|
||||
static MachineLocation storedLoc; /* InsideMac, OSUtilities, page 4-20 */
|
||||
static JSBool didReadLocation = JS_FALSE;
|
||||
if (!didReadLocation)
|
||||
{
|
||||
MacintoshInitializeTime();
|
||||
ReadLocation(&storedLoc);
|
||||
/* install a sleep queue routine, so that when the machine wakes up, time can be recomputed. */
|
||||
if (&SleepQInstall != (void*)kUnresolvedCFragSymbolAddress
|
||||
#if !TARGET_CARBON
|
||||
&& NGetTrapAddress(0xA28A, OSTrap) != NGetTrapAddress(_Unimplemented, ToolTrap)
|
||||
#endif
|
||||
) {
|
||||
if ((gSleepQEntry.sleepQProc = NewSleepQUPP(MySleepQProc)) != NULL) {
|
||||
SleepQInstall(&gSleepQEntry);
|
||||
gSleepQEntryInstalled = JS_TRUE;
|
||||
}
|
||||
}
|
||||
didReadLocation = JS_TRUE;
|
||||
}
|
||||
*loc = storedLoc;
|
||||
}
|
||||
|
||||
|
||||
#ifndef XP_MACOSX
|
||||
|
||||
/* CFM library init and terminate routines. We'll use the terminate routine
|
||||
to clean up the sleep Q entry. On Mach-O, the sleep Q entry gets cleaned
|
||||
up for us, so nothing to do there.
|
||||
*/
|
||||
|
||||
extern pascal OSErr __NSInitialize(const CFragInitBlock* initBlock);
|
||||
extern pascal void __NSTerminate();
|
||||
|
||||
pascal OSErr __JSInitialize(const CFragInitBlock* initBlock);
|
||||
pascal void __JSTerminate(void);
|
||||
|
||||
pascal OSErr __JSInitialize(const CFragInitBlock* initBlock)
|
||||
{
|
||||
return __NSInitialize(initBlock);
|
||||
}
|
||||
|
||||
pascal void __JSTerminate()
|
||||
{
|
||||
/* clean up the sleepQ entry */
|
||||
if (gSleepQEntryInstalled)
|
||||
SleepQRemove(&gSleepQEntry);
|
||||
|
||||
__NSTerminate();
|
||||
}
|
||||
#endif /* XP_MACOSX */
|
||||
|
||||
#endif /* XP_MAC */
|
||||
|
||||
#define IS_LEAP(year) \
|
||||
(year != 0 && ((((year & 0x3) == 0) && \
|
||||
((year - ((year/100) * 100)) != 0)) || \
|
||||
|
@ -239,32 +104,6 @@ PRMJ_LocalGMTDifference()
|
|||
return mktime(<ime) - (24L * 3600L);
|
||||
#endif
|
||||
#endif
|
||||
#if defined(XP_MAC)
|
||||
static JSInt32 zone = -1L;
|
||||
MachineLocation machineLocation;
|
||||
JSInt32 gmtOffsetSeconds;
|
||||
|
||||
/* difference has been set no need to recalculate */
|
||||
if (zone != -1)
|
||||
return zone;
|
||||
|
||||
/* Get the information about the local machine, including
|
||||
* its GMT offset and its daylight savings time info.
|
||||
* Convert each into wides that we can add to
|
||||
* startupTimeMicroSeconds.
|
||||
*/
|
||||
|
||||
MyReadLocation(&machineLocation);
|
||||
|
||||
/* Mask off top eight bits of gmtDelta, sign extend lower three. */
|
||||
gmtOffsetSeconds = (machineLocation.u.gmtDelta << 8);
|
||||
gmtOffsetSeconds >>= 8;
|
||||
|
||||
/* Backout OS adjustment for DST, to give consistent GMT offset. */
|
||||
if (machineLocation.u.dlsDelta != 0)
|
||||
gmtOffsetSeconds -= PRMJ_HOUR_SECONDS;
|
||||
return (zone = -gmtOffsetSeconds);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Constants for GMT offset from 1970 */
|
||||
|
@ -323,14 +162,6 @@ PRMJ_Now(void)
|
|||
struct timeval tv;
|
||||
JSInt64 s, us, s2us;
|
||||
#endif /* XP_UNIX */
|
||||
#ifdef XP_MAC
|
||||
JSUint64 upTime;
|
||||
JSInt64 localTime;
|
||||
JSInt64 gmtOffset;
|
||||
JSInt64 dstOffset;
|
||||
JSInt32 gmtDiff;
|
||||
JSInt64 s2us;
|
||||
#endif /* XP_MAC */
|
||||
|
||||
#ifdef XP_OS2
|
||||
ftime(&b);
|
||||
|
@ -378,24 +209,6 @@ PRMJ_Now(void)
|
|||
JSLL_ADD(s, s, us);
|
||||
return s;
|
||||
#endif /* XP_UNIX */
|
||||
#ifdef XP_MAC
|
||||
JSLL_UI2L(localTime,0);
|
||||
gmtDiff = PRMJ_LocalGMTDifference();
|
||||
JSLL_I2L(gmtOffset,gmtDiff);
|
||||
JSLL_UI2L(s2us, PRMJ_USEC_PER_SEC);
|
||||
JSLL_MUL(gmtOffset,gmtOffset,s2us);
|
||||
|
||||
/* don't adjust for DST since it sets ctime and gmtime off on the MAC */
|
||||
Microseconds((UnsignedWide*)&upTime);
|
||||
JSLL_ADD(localTime,localTime,gmtOffset);
|
||||
JSLL_ADD(localTime,localTime, dstLocalBaseMicroseconds);
|
||||
JSLL_ADD(localTime,localTime, upTime);
|
||||
|
||||
dstOffset = PRMJ_DSTOffset(localTime);
|
||||
JSLL_SUB(localTime,localTime,dstOffset);
|
||||
|
||||
return *((JSUint64 *)&localTime);
|
||||
#endif /* XP_MAC */
|
||||
}
|
||||
|
||||
/* Get the DST timezone offset for the time passed in */
|
||||
|
@ -403,24 +216,6 @@ JSInt64
|
|||
PRMJ_DSTOffset(JSInt64 local_time)
|
||||
{
|
||||
JSInt64 us2s;
|
||||
#ifdef XP_MAC
|
||||
/*
|
||||
* Convert the local time passed in to Macintosh epoch seconds. Use UTC utilities to convert
|
||||
* to UTC time, then compare difference with our GMT offset. If they are the same, then
|
||||
* DST must not be in effect for the input date/time.
|
||||
*/
|
||||
UInt32 macLocalSeconds = (local_time / PRMJ_USEC_PER_SEC) + gJanuaryFirst1970Seconds, utcSeconds;
|
||||
ConvertLocalTimeToUTC(macLocalSeconds, &utcSeconds);
|
||||
if ((utcSeconds - macLocalSeconds) == PRMJ_LocalGMTDifference())
|
||||
return 0;
|
||||
else {
|
||||
JSInt64 dlsOffset;
|
||||
JSLL_UI2L(us2s, PRMJ_USEC_PER_SEC);
|
||||
JSLL_UI2L(dlsOffset, PRMJ_HOUR_SECONDS);
|
||||
JSLL_MUL(dlsOffset, dlsOffset, us2s);
|
||||
return dlsOffset;
|
||||
}
|
||||
#else
|
||||
time_t local;
|
||||
JSInt32 diff;
|
||||
JSInt64 maxtimet;
|
||||
|
@ -467,14 +262,13 @@ PRMJ_DSTOffset(JSInt64 local_time)
|
|||
JSLL_MUL(local_time,local_time,us2s);
|
||||
|
||||
return(local_time);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Format a time value into a buffer. Same semantics as strftime() */
|
||||
size_t
|
||||
PRMJ_FormatTime(char *buf, int buflen, char *fmt, PRMJTime *prtm)
|
||||
{
|
||||
#if defined(XP_UNIX) || defined(XP_WIN) || defined(XP_OS2) || defined(XP_MAC) || defined(XP_BEOS)
|
||||
#if defined(XP_UNIX) || defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS)
|
||||
struct tm a;
|
||||
|
||||
/* Zero out the tm struct. Linux, SunOS 4 struct tm has extra members int
|
||||
|
|
|
@ -165,11 +165,6 @@ Dump(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
char *bytes = JS_GetStringBytes(str);
|
||||
bytes = nsCRT::strdup(bytes);
|
||||
|
||||
#ifdef XP_MAC
|
||||
for (char *c = bytes; *c; c++)
|
||||
if (*c == '\r')
|
||||
*c = '\n';
|
||||
#endif
|
||||
fputs(bytes, stderr);
|
||||
nsMemory::Free(bytes);
|
||||
return JS_TRUE;
|
||||
|
|
|
@ -72,9 +72,6 @@
|
|||
#include <io.h> /* for isatty() */
|
||||
#elif defined(XP_UNIX) || defined(XP_BEOS)
|
||||
#include <unistd.h> /* for isatty() */
|
||||
#elif defined(XP_MAC)
|
||||
#include <unistd.h>
|
||||
#include <unix.h>
|
||||
#endif
|
||||
|
||||
#include "nsIJSContextStack.h"
|
||||
|
@ -202,11 +199,6 @@ Dump(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
char *bytes = JS_GetStringBytes(str);
|
||||
bytes = strdup(bytes);
|
||||
|
||||
#ifdef XP_MAC
|
||||
for (char *c = bytes; *c; c++)
|
||||
if (*c == '\r')
|
||||
*c = '\n';
|
||||
#endif
|
||||
fputs(bytes, gOutFile);
|
||||
nsMemory::Free(bytes);
|
||||
return JS_TRUE;
|
||||
|
@ -873,34 +865,6 @@ FullTrustSecMan::CanAccess(PRUint32 aAction, nsIXPCNativeCallContext *aCallConte
|
|||
|
||||
/***************************************************************************/
|
||||
|
||||
#if defined(XP_MAC)
|
||||
#include <SIOUX.h>
|
||||
#include <MacTypes.h>
|
||||
|
||||
static void initConsole(StringPtr consoleName, const char* startupMessage, int *argc, char** *argv)
|
||||
{
|
||||
SIOUXSettings.autocloseonquit = true;
|
||||
SIOUXSettings.asktosaveonclose = false;
|
||||
SIOUXSettings.userwindowtitle = consoleName;
|
||||
SIOUXSettings.standalone = true;
|
||||
SIOUXSettings.setupmenus = true;
|
||||
SIOUXSettings.toppixel = 42;
|
||||
SIOUXSettings.leftpixel = 6;
|
||||
SIOUXSettings.rows = 40;
|
||||
SIOUXSettings.columns = 100;
|
||||
// SIOUXSettings.initializeTB = false;
|
||||
// SIOUXSettings.showstatusline = true;
|
||||
puts(startupMessage);
|
||||
|
||||
/* set up a buffer for stderr (otherwise it's a pig). */
|
||||
setvbuf(stderr, (char *) malloc(BUFSIZ), _IOLBF, BUFSIZ);
|
||||
|
||||
static char* mac_argv[] = { "xpcshell", NULL };
|
||||
*argc = 1;
|
||||
*argv = mac_argv;
|
||||
}
|
||||
#endif
|
||||
|
||||
// #define TEST_InitClassesWithNewWrappedGlobal
|
||||
|
||||
#ifdef TEST_InitClassesWithNewWrappedGlobal
|
||||
|
@ -992,10 +956,6 @@ main(int argc, char **argv, char **envp)
|
|||
int result;
|
||||
nsresult rv;
|
||||
|
||||
#if defined(XP_MAC)
|
||||
initConsole("\pXPConnect Shell", "Welcome to the XPConnect Shell.\n", &argc, &argv);
|
||||
#endif
|
||||
|
||||
gErrFile = stderr;
|
||||
gOutFile = stdout;
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче