Compare commits
1 Commits
JS_STABLE_
...
jsd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e99fb1da7b |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,38 +1,27 @@
|
||||
# This file is required for the Mac client mozilla build.
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
js.msg
|
||||
jsapi.h
|
||||
jsarena.h
|
||||
jspubtd.h
|
||||
jsarray.h
|
||||
jsatom.h
|
||||
jsbool.h
|
||||
jsclist.h
|
||||
jscntxt.h
|
||||
jscompat.h
|
||||
jsconfig.h
|
||||
jscpucfg.h
|
||||
jsdate.h
|
||||
jsdbgapi.h
|
||||
jsdtoa.h
|
||||
jsemit.h
|
||||
jsfun.h
|
||||
jsgc.h
|
||||
jshash.h
|
||||
jsinterp.h
|
||||
jslock.h
|
||||
jslong.h
|
||||
jsmath.h
|
||||
jsnum.h
|
||||
jsobj.h
|
||||
jsopcode.tbl
|
||||
jsopcode.def
|
||||
jsopcode.h
|
||||
jsosdep.h
|
||||
jsotypes.h
|
||||
jsparse.h
|
||||
jsprf.h
|
||||
jsprvtd.h
|
||||
jspubtd.h
|
||||
jsregexp.h
|
||||
@@ -40,8 +29,3 @@ jsscan.h
|
||||
jsscope.h
|
||||
jsscript.h
|
||||
jsstr.h
|
||||
jstypes.h
|
||||
jsutil.h
|
||||
jsxdrapi.h
|
||||
|
||||
|
||||
|
||||
@@ -37,70 +37,52 @@ endif
|
||||
|
||||
MODULE = js
|
||||
|
||||
CSRCS = jsapi.c \
|
||||
jsarena.c \
|
||||
jsarray.c \
|
||||
jsatom.c \
|
||||
jsbool.c \
|
||||
jscntxt.c \
|
||||
jsdate.c \
|
||||
jsdbgapi.c \
|
||||
jsdtoa.c \
|
||||
jsemit.c \
|
||||
jsexn.c \
|
||||
jsfun.c \
|
||||
jsgc.c \
|
||||
jshash.c \
|
||||
jsinterp.c \
|
||||
jslock.c \
|
||||
jslog2.c \
|
||||
jslong.c \
|
||||
jsmath.c \
|
||||
jsnum.c \
|
||||
jsobj.c \
|
||||
jsopcode.c \
|
||||
jsparse.c \
|
||||
jsprf.c \
|
||||
jsregexp.c \
|
||||
jsscan.c \
|
||||
jsscope.c \
|
||||
jsscript.c \
|
||||
jsstr.c \
|
||||
jsutil.c \
|
||||
jsxdrapi.c \
|
||||
prmjtime.c \
|
||||
$(NULL)
|
||||
CSRCS = jsapi.c \
|
||||
jsarray.c \
|
||||
jsatom.c \
|
||||
jsbool.c \
|
||||
jscntxt.c \
|
||||
jsdate.c \
|
||||
jsdbgapi.c \
|
||||
jsemit.c \
|
||||
jsfun.c \
|
||||
jsgc.c \
|
||||
jsinterp.c \
|
||||
jsmath.c \
|
||||
jsnum.c \
|
||||
jsobj.c \
|
||||
jsopcode.c \
|
||||
jsparse.c \
|
||||
jsregexp.c \
|
||||
jsscan.c \
|
||||
jsscope.c \
|
||||
jsscript.c \
|
||||
jsstr.c \
|
||||
jslock.c \
|
||||
jsxdrapi.c \
|
||||
prmjtime.c \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = js.msg \
|
||||
jsapi.h \
|
||||
EXPORTS = jsapi.h \
|
||||
jsarray.h \
|
||||
jsarena.h \
|
||||
jsatom.h \
|
||||
jsbit.h \
|
||||
jsbool.h \
|
||||
jsclist.h \
|
||||
jscntxt.h \
|
||||
jscompat.h \
|
||||
jsconfig.h \
|
||||
jscpucfg.h \
|
||||
jsdate.h \
|
||||
jsdbgapi.h \
|
||||
jsemit.h \
|
||||
jsfun.h \
|
||||
jsgc.h \
|
||||
jshash.h \
|
||||
jsinterp.h \
|
||||
jslock.h \
|
||||
jslong.h \
|
||||
jsmath.h \
|
||||
jsnum.h \
|
||||
jsobj.h \
|
||||
jsopcode.tbl \
|
||||
jsopcode.def \
|
||||
jsopcode.h \
|
||||
jsosdep.h \
|
||||
jsotypes.h \
|
||||
jsparse.h \
|
||||
jsprf.h \
|
||||
jsprvtd.h \
|
||||
jspubtd.h \
|
||||
jsregexp.h \
|
||||
@@ -108,8 +90,6 @@ EXPORTS = js.msg \
|
||||
jsscope.h \
|
||||
jsscript.h \
|
||||
jsstr.h \
|
||||
jstypes.h \
|
||||
jsutil.h \
|
||||
jsxdrapi.h \
|
||||
$(NULL)
|
||||
|
||||
@@ -122,6 +102,7 @@ JS_SAFE_ARENA = 1
|
||||
|
||||
ifdef JS_SAFE_ARENA
|
||||
DEFINES += -DJS_USE_SAFE_ARENA
|
||||
CSRCS += prarena.c
|
||||
endif
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
@@ -184,7 +165,8 @@ JSJAVA_CFLAGS = -I$(DEPTH)/sun-java/md-include \
|
||||
-I$(DEPTH)/sun-java/include \
|
||||
$(JSJAVA_STUBHEADERS)
|
||||
|
||||
# LIBNSPR abstracts nspr version, etc. nicely.
|
||||
# LIBNSPR includes unneeded libmsgc21.a, but abstracts nspr version,
|
||||
# etc. nicely.
|
||||
LDFLAGS = $(LIBNSPR) -lm
|
||||
|
||||
ifeq ($(OS_ARCH), OSF1)
|
||||
@@ -215,8 +197,8 @@ $(OBJDIR)/js$(BIN_SUFFIX): $(OBJDIR)/js.o $(LIBRARY)
|
||||
$(LINK_EXE) -OUT:$@ $(OBJDIR)/js.o $(LIBRARIES) $(EXTRA_LIBS)
|
||||
endif
|
||||
|
||||
# hardwire dependencies on jsopcode.tbl
|
||||
jsopcode.h jsopcode.c: jsopcode.tbl
|
||||
# hardwire dependencies on jsopcode.def
|
||||
jsopcode.h jsopcode.c: jsopcode.def
|
||||
|
||||
# this section was put in the merged by danda into the
|
||||
# JAVA_*_MERGE section and normally would have
|
||||
|
||||
@@ -40,70 +40,52 @@ endif
|
||||
|
||||
MODULE = js
|
||||
|
||||
CSRCS = jsapi.c \
|
||||
jsarena.c \
|
||||
jsarray.c \
|
||||
jsatom.c \
|
||||
jsbool.c \
|
||||
jscntxt.c \
|
||||
jsdate.c \
|
||||
jsdbgapi.c \
|
||||
jsdtoa.c \
|
||||
jsemit.c \
|
||||
jsexn.c \
|
||||
jsfun.c \
|
||||
jsgc.c \
|
||||
jshash.c \
|
||||
jsinterp.c \
|
||||
jslock.c \
|
||||
jslog2.c \
|
||||
jslong.c \
|
||||
jsmath.c \
|
||||
jsnum.c \
|
||||
jsobj.c \
|
||||
jsopcode.c \
|
||||
jsparse.c \
|
||||
jsprf.c \
|
||||
jsregexp.c \
|
||||
jsscan.c \
|
||||
jsscope.c \
|
||||
jsscript.c \
|
||||
jsstr.c \
|
||||
jsutil.c \
|
||||
jsxdrapi.c \
|
||||
prmjtime.c \
|
||||
CSRCS = jsapi.c \
|
||||
jsarray.c \
|
||||
jsatom.c \
|
||||
jsbool.c \
|
||||
jscntxt.c \
|
||||
jsdate.c \
|
||||
jsdbgapi.c \
|
||||
jsemit.c \
|
||||
jsfun.c \
|
||||
jsgc.c \
|
||||
jsinterp.c \
|
||||
jsmath.c \
|
||||
jsnum.c \
|
||||
jsobj.c \
|
||||
jsopcode.c \
|
||||
jsparse.c \
|
||||
jsregexp.c \
|
||||
jsscan.c \
|
||||
jsscope.c \
|
||||
jsscript.c \
|
||||
jsstr.c \
|
||||
jslock.c \
|
||||
jsxdrapi.c \
|
||||
prmjtime.c \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = js.msg \
|
||||
jsapi.h \
|
||||
EXPORTS = jsapi.h \
|
||||
jsarray.h \
|
||||
jsarena.h \
|
||||
jsatom.h \
|
||||
jsbit.h \
|
||||
jsbool.h \
|
||||
jsclist.h \
|
||||
jscntxt.h \
|
||||
jscompat.h \
|
||||
jsconfig.h \
|
||||
jscpucfg.h \
|
||||
jsdate.h \
|
||||
jsdbgapi.h \
|
||||
jsemit.h \
|
||||
jsfun.h \
|
||||
jsgc.h \
|
||||
jshash.h \
|
||||
jsinterp.h \
|
||||
jslock.h \
|
||||
jslong.h \
|
||||
jsmath.h \
|
||||
jsnum.h \
|
||||
jsobj.h \
|
||||
jsopcode.tbl \
|
||||
jsopcode.def \
|
||||
jsopcode.h \
|
||||
jsosdep.h \
|
||||
jsotypes.h \
|
||||
jsparse.h \
|
||||
jsprf.h \
|
||||
jsprvtd.h \
|
||||
jspubtd.h \
|
||||
jsregexp.h \
|
||||
@@ -111,8 +93,6 @@ EXPORTS = js.msg \
|
||||
jsscope.h \
|
||||
jsscript.h \
|
||||
jsstr.h \
|
||||
jstypes.h \
|
||||
jsutil.h \
|
||||
jsxdrapi.h \
|
||||
$(NULL)
|
||||
|
||||
@@ -127,6 +107,7 @@ JS_SAFE_ARENA = 1
|
||||
|
||||
ifdef JS_SAFE_ARENA
|
||||
DEFINES += -DJS_USE_SAFE_ARENA
|
||||
CSRCS += prarena.c
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
@@ -189,7 +170,8 @@ JSJAVA_CFLAGS = -I$(topsrcdir)/sun-java/md-include \
|
||||
-I$(topsrcdir)/sun-java/include \
|
||||
$(JSJAVA_STUBHEADERS)
|
||||
|
||||
# LIBNSPR abstracts nspr version, etc. nicely.
|
||||
# LIBNSPR includes unneeded libmsgc21.a, but abstracts nspr version,
|
||||
# etc. nicely.
|
||||
LDFLAGS = $(LIBNSPR) -lm
|
||||
|
||||
ifeq ($(OS_ARCH), OSF1)
|
||||
@@ -221,7 +203,7 @@ $(OBJDIR)/js$(BIN_SUFFIX): $(OBJDIR)/js.o $(LIBRARY)
|
||||
endif
|
||||
|
||||
# hardwire dependencies on jsopcode.def
|
||||
jsopcode.h jsopcode.c: jsopcode.tbl
|
||||
jsopcode.h jsopcode.c: jsopcode.def
|
||||
|
||||
# this section was put in the merged by danda into the
|
||||
# JAVA_*_MERGE section and normally would have
|
||||
|
||||
@@ -18,33 +18,78 @@
|
||||
# JSRef GNUmake makefile.
|
||||
#
|
||||
|
||||
DEPTH = .
|
||||
# Set os+release dependent make variables
|
||||
OS_ARCH := $(subst /,_,$(shell uname -s))
|
||||
|
||||
include config.mk
|
||||
# Attempt to differentiate between SunOS 5.4 and x86 5.4
|
||||
OS_CPUARCH := $(shell uname -m)
|
||||
ifeq ($(OS_CPUARCH),i86pc)
|
||||
OS_RELEASE := $(shell uname -r)_$(OS_CPUARCH)
|
||||
else
|
||||
ifeq ($(OS_ARCH),AIX)
|
||||
OS_RELEASE := $(shell uname -v).$(shell uname -r)
|
||||
else
|
||||
OS_RELEASE := $(shell uname -r)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Virtually all Linux versions are identical.
|
||||
# Any distinctions are handled in linux.h
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
OS_CONFIG := Linux_All
|
||||
else
|
||||
ifeq ($(OS_ARCH),dgux)
|
||||
OS_CONFIG := dgux
|
||||
else
|
||||
OS_CONFIG := $(OS_ARCH)$(OS_OBJTYPE)$(OS_RELEASE)
|
||||
endif
|
||||
endif
|
||||
|
||||
ASFLAGS =
|
||||
DEFINES =
|
||||
|
||||
#NS_USE_NATIVE = 1
|
||||
|
||||
ifdef JS_THREADSAFE
|
||||
DEFINES += -DJS_THREADSAFE
|
||||
INCLUDES += -I../../dist/$(OBJDIR)/include
|
||||
include config/$(OS_CONFIG).mk
|
||||
|
||||
ifdef BUILD_OPT
|
||||
OPTIMIZER += -O
|
||||
DEFINES += -UDEBUG -DNDEBUG -UDEBUG_$(shell whoami)
|
||||
OBJDIR_TAG = _OPT
|
||||
else
|
||||
ifdef USE_MSVC
|
||||
OTHER_LIBS += ../../dist/$(OBJDIR)/lib/libnspr21.lib
|
||||
OPTIMIZER = -Zi
|
||||
else
|
||||
OTHER_LIBS += -L../../dist/$(OBJDIR)/lib -lnspr21
|
||||
OPTIMIZER = -g
|
||||
endif
|
||||
else
|
||||
# Look in OBJDIR to find prcpucfg.h
|
||||
INCLUDES += -I$(OBJDIR)
|
||||
DEFINES += -DDEBUG -DDEBUG_$(shell whoami)
|
||||
OBJDIR_TAG = _DBG
|
||||
endif
|
||||
|
||||
#DEFINES += -DJS_THREADSAFE
|
||||
|
||||
ifdef JS_NO_THIN_LOCKS
|
||||
DEFINES += -DJS_USE_ONLY_NSPR_LOCKS
|
||||
endif
|
||||
|
||||
# Name of the binary code directories
|
||||
OBJDIR = $(OS_CONFIG)$(OBJDIR_TAG).OBJ
|
||||
VPATH = $(OBJDIR)
|
||||
|
||||
# Automatic make dependencies file
|
||||
DEPENDENCIES = $(OBJDIR)/.md
|
||||
|
||||
define MAKE_OBJDIR
|
||||
if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); fi
|
||||
endef
|
||||
|
||||
# Look in OBJDIR to find prcpucfg.h
|
||||
INCLUDES = -I$(OBJDIR)
|
||||
|
||||
#
|
||||
# XCFLAGS may be set in the environment or on the gmake command line
|
||||
#
|
||||
CFLAGS += $(OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) \
|
||||
CFLAGS = $(OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) \
|
||||
-DJSFILE $(XCFLAGS)
|
||||
LDFLAGS = -lm $(XLDFLAGS)
|
||||
|
||||
@@ -52,7 +97,7 @@ LDFLAGS = -lm $(XLDFLAGS)
|
||||
# Ask perl what flags it was built with, so we can build js with similar flags
|
||||
# and link properly. Viva gmake.
|
||||
#
|
||||
ifdef JS_PERLCONNECT
|
||||
ifdef PERLCONNECT
|
||||
DEFINES += -DPERLCONNECT
|
||||
|
||||
PERLCFLAGS := $(shell perl -MExtUtils::Embed -e ccopts)
|
||||
@@ -92,7 +137,11 @@ JS_HFILES = \
|
||||
jsdtoa.h \
|
||||
jshash.h \
|
||||
jslong.h \
|
||||
jsmacos.h \
|
||||
jsosdep.h \
|
||||
jspcos.h \
|
||||
jsprintf.h \
|
||||
jstime.h \
|
||||
jstypes.h \
|
||||
jsprvtd.h \
|
||||
jspubtd.h \
|
||||
@@ -113,28 +162,28 @@ HFILES = $(JS_HFILES) $(API_HFILES)
|
||||
|
||||
JS_CFILES = \
|
||||
jsapi.c \
|
||||
jsarena.c \
|
||||
jsarray.c \
|
||||
jsatom.c \
|
||||
jsbool.c \
|
||||
jscntxt.c \
|
||||
jsdate.c \
|
||||
jsdbgapi.c \
|
||||
jsdtoa.c \
|
||||
jsemit.c \
|
||||
jsexn.c \
|
||||
jsfun.c \
|
||||
jsgc.c \
|
||||
jshash.c \
|
||||
jsinterp.c \
|
||||
jslock.c \
|
||||
jslog2.c \
|
||||
jslong.c \
|
||||
jsmath.c \
|
||||
jsnum.c \
|
||||
jsobj.c \
|
||||
jsopcode.c \
|
||||
jsparse.c \
|
||||
jsarena.c \
|
||||
jsdtoa.c \
|
||||
jshash.c \
|
||||
jslog2.c \
|
||||
jslong.c \
|
||||
jsprf.c \
|
||||
jsregexp.c \
|
||||
jsscan.c \
|
||||
@@ -146,11 +195,7 @@ JS_CFILES = \
|
||||
prmjtime.c \
|
||||
$(NULL)
|
||||
|
||||
ifdef JS_LIVECONNECT
|
||||
DIRS = liveconnect
|
||||
endif
|
||||
|
||||
ifdef JS_PERLCONNECT
|
||||
ifdef PERLCONNECT
|
||||
JS_CFILES += jsperl.c
|
||||
endif
|
||||
|
||||
@@ -159,33 +204,84 @@ LIB_ASFILES := $(wildcard *_$(OS_ARCH).s)
|
||||
PROG_CFILES = js.c
|
||||
|
||||
ifdef USE_MSVC
|
||||
LIBRARY = $(OBJDIR)/js32.lib
|
||||
SHARED_LIBRARY = $(OBJDIR)/js32.dll
|
||||
PROGRAM = $(OBJDIR)/js.exe
|
||||
LIB_OBJS = $(addprefix $(OBJDIR)/, $(LIB_CFILES:.c=.obj))
|
||||
PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CFILES:.c=.obj))
|
||||
else
|
||||
LIB_OBJS = $(addprefix $(OBJDIR)/, $(LIB_CFILES:.c=.o))
|
||||
LIB_OBJS += $(addprefix $(OBJDIR)/, $(LIB_ASFILES:.s=.o))
|
||||
PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CFILES:.c=.o))
|
||||
endif
|
||||
|
||||
CFILES = $(LIB_CFILES) $(PROG_CFILES)
|
||||
OBJS = $(LIB_OBJS) $(PROG_OBJS)
|
||||
|
||||
ifdef USE_MSVC
|
||||
LIBRARY = $(OBJDIR)/js32.dll
|
||||
PROGRAM = $(OBJDIR)/js
|
||||
else
|
||||
LIBRARY = $(OBJDIR)/libjs.a
|
||||
SHARED_LIBRARY = $(OBJDIR)/libjs.so
|
||||
PROGRAM = $(OBJDIR)/js
|
||||
endif
|
||||
|
||||
include rules.mk
|
||||
|
||||
MOZ_DEPTH = ../..
|
||||
include jsconfig.mk
|
||||
|
||||
nsinstall-target:
|
||||
cd ../../config; $(MAKE) OBJDIR=$(OBJDIR) OBJDIR_NAME=$(OBJDIR)
|
||||
ifdef USE_MSVC
|
||||
$(PROGRAM): $(PROG_OBJS) $(LIBRARY)
|
||||
link.exe -out:"$@" $(EXE_LINK_FLAGS) $?
|
||||
TARGETS = $(LIBRARY) # $(PROGRAM) not supported for MSVC yet
|
||||
else
|
||||
$(PROGRAM): $(PROG_OBJS) $(LIBRARY)
|
||||
$(CC) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) $(OTHER_LIBS)
|
||||
TARGETS = $(LIBRARY) $(PROGRAM)
|
||||
endif
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJS)
|
||||
|
||||
clobber:
|
||||
rm -rf $(OBJS) $(TARGETS) $(DEPENDENCIES)
|
||||
|
||||
depend:
|
||||
gcc -MM $(CFLAGS) $(JS_CFILES)
|
||||
|
||||
$(OBJDIR)/%: %.c
|
||||
@$(MAKE_OBJDIR)
|
||||
$(CC) -o $@ $(CFLAGS) $*.c $(LDFLAGS)
|
||||
|
||||
$(OBJDIR)/%.o: %.c
|
||||
@$(MAKE_OBJDIR)
|
||||
$(CC) -o $@ -c $(CFLAGS) $*.c
|
||||
|
||||
$(OBJDIR)/%.o: %.s
|
||||
@$(MAKE_OBJDIR)
|
||||
$(AS) -o $@ $(ASFLAGS) $*.s
|
||||
|
||||
# windows only
|
||||
$(OBJDIR)/%.obj: %.c
|
||||
@$(MAKE_OBJDIR)
|
||||
$(CC) -Fo$(OBJDIR)/ -c $(CFLAGS) $*.c
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
$(LIBRARY): $(LIB_OBJS)
|
||||
$(AR) $@ $? $(AR_OS2_SUFFIX)
|
||||
$(RANLIB) $@
|
||||
else
|
||||
ifdef USE_MSVC
|
||||
$(LIBRARY): $(LIB_OBJS)
|
||||
link.exe $(LIB_LINK_FLAGS) /base:0x61000000 \
|
||||
/out:"$@" /pdb:"$(OBJDIR)/js32.pdb" /implib:"$(OBJDIR)/js32.lib" $?
|
||||
else
|
||||
$(LIBRARY): $(LIB_OBJS)
|
||||
$(AR) rv $@ $?
|
||||
$(RANLIB) $@
|
||||
endif
|
||||
endif
|
||||
|
||||
#NSPR_LIBRARY = ../../dist/$(OBJDIR)/lib/libnspr21.so
|
||||
NSPR_LIBRARY =
|
||||
|
||||
$(PROGRAM): $(PROG_OBJS) $(LIBRARY)
|
||||
$(CC) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(NSPR_LIBRARY) $(LDFLAGS)
|
||||
|
||||
$(PROGRAM).pure: $(PROG_OBJS) $(LIBRARY)
|
||||
purify $(PUREFLAGS) \
|
||||
$(CC) -o $@ $(PURE_OS_CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) $(OTHER_LIBS)
|
||||
$(CC) -o $@ $(PURE_OS_CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS)
|
||||
|
||||
$(HFILES) $(CFILES): $(OBJDIR)/jscpucfg.h
|
||||
|
||||
@@ -211,6 +307,10 @@ jsopcode.h jsopcode.c: jsopcode.tbl
|
||||
TARNAME = jsref.tar
|
||||
TARFILES = files `cat files`
|
||||
|
||||
tar:
|
||||
tar cvf $(TARNAME) $(TARFILES)
|
||||
gzip $(TARNAME)
|
||||
|
||||
SUFFIXES: .i
|
||||
%.i: %.c
|
||||
$(CC) -C -E $(CFLAGS) $< > $*.i
|
||||
|
||||
17
mozilla/js/src/README
Normal file
17
mozilla/js/src/README
Normal file
@@ -0,0 +1,17 @@
|
||||
The js/ref directory contains standalone ANSI-C source for the Netscape
|
||||
JavaScript Reference implementation, JSRef, which was licensed to over 180
|
||||
companies as part of Netscape ONE, starting in fall 1996. Now, JSRef is
|
||||
available under NPL from http://www.mozilla.org.
|
||||
|
||||
The js/src directory contains source files listed in the file "commfiles",
|
||||
that are derived via prconv.sed from counterparts in the js/ref directory.
|
||||
It also contains files such as jscompat.h that are not needed in js/ref.
|
||||
The Makefile in js/src has refconv and refdiff targets to help keep js/ref
|
||||
and js/src in synch.
|
||||
|
||||
If you think you need to change a file listed in commfiles here, please
|
||||
make the change in js/ref first and then use prconv.sed or gmake refconv to
|
||||
get it into js/src. If you have trouble, please let us know by mailing the
|
||||
JS owner and peers listed in http://www.mozilla.org/owners.html#JavaScript.
|
||||
|
||||
Brendan Eich (brendan@mozilla.org), 15-May-98
|
||||
@@ -1,673 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<META NAME="GENERATOR" CONTENT="Mozilla/4.5b2 [en] (WinNT; I) [Netscape]">
|
||||
<TITLE>JavaScript Reference Implementation (JSRef) README</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
|
||||
<H2>
|
||||
Introduction</H2>
|
||||
This is the README file for the <SPAN CLASS=LXRSHORTDESC>JavaScript Reference (JSRef) implementation.</SPAN>
|
||||
It consists of build conventions and instructions, source code conventions,
|
||||
a design walk-through, and a brief file-by-file description of the source.
|
||||
<P><SPAN CLASS=LXRLONGDESC>JSRef builds a library or DLL containing the JavaScript runtime (compiler,
|
||||
interpreter, decompiler, garbage collector, atom manager, standard classes).
|
||||
It then compiles a small "shell" program and links that with the library
|
||||
to make an interpreter that can be used interactively and with test .js
|
||||
files to run scripts. The code has no dependencies on the Navigator.</SPAN>
|
||||
<P><I>Quick start tip</I>: skip to "Using the JS API" below, build js,
|
||||
and play with the object named "it" (start by setting 'it.noisy = true').
|
||||
<H2>
|
||||
Build conventions</H2>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
On Windows, use MSDEV4.2 or 5.0. Use either the js.mdp project file
|
||||
to build with the IDE or '<TT>nmake -f js.mak</TT>' to build from the command-line</LI>
|
||||
|
||||
<LI>
|
||||
On Mac, use CodeWarrior 3.x (<TT>JSRef.mcp</TT> in the <TT>js/src/macbuild</TT>
|
||||
subdirectory)</LI>
|
||||
|
||||
<LI>
|
||||
On Unix, use vendor cc or <A HREF="ftp://prep.ai.mit.edu/pub/gnu">gcc</A>
|
||||
for compiling, and use '<TT>gmake -f Makefile.ref</TT>' for building. To
|
||||
compile optimized code, pass
|
||||
<TT>BUILD_OPT=1</TT> on the nmake/gmake command
|
||||
line or preset it in the environment or makefile. The C preprocessor macro
|
||||
<TT>DEBUG</TT>
|
||||
will be undefined, and <TT>NDEBUG </TT>(archaic Unix-ism for "No Debugging")
|
||||
will be defined. Without <TT>BUILD_OPT</TT>, <TT>DEBUG</TT> is predefined
|
||||
and
|
||||
<TT>NDEBUG</TT> is undefined. On Unix, your own debug flag, <TT>DEBUG_$USER</TT>,
|
||||
will be defined or undefined as <TT>BUILD_OPT</TT> is unset or set.</LI>
|
||||
|
||||
<LI>
|
||||
To add C compiler options from the make command line, set <TT>XCFLAGS=-Dfoo</TT>.
|
||||
To predefine -D or -U options in the makefile, set <TT>DEFINES</TT>. To
|
||||
predefine -I options in the makefile, set INCLUDES.</LI>
|
||||
|
||||
<LI>
|
||||
To turn on GC instrumentation, define <TT>JS_GCMETER</TT>.</LI>
|
||||
|
||||
<LI>
|
||||
To enable multi-threaded execution, define <TT>JS_THREADSAFE</TT> and flesh
|
||||
out the stubs and required headers in <I>jslock.c</I> and <I>jslock.h</I>.
|
||||
See the JS API docs for more.</LI>
|
||||
|
||||
<LI>
|
||||
To turn on the arena package's instrumentation, define <TT>JS_ARENAMETER</TT>.</LI>
|
||||
|
||||
<LI>
|
||||
To turn on the hash table package's metering, define <TT>JS_HASHMETER</TT>.</LI>
|
||||
</UL>
|
||||
|
||||
<H2>
|
||||
Naming and coding conventions</H2>
|
||||
|
||||
<UL>
|
||||
<LI>
|
||||
Public function names begin with <TT>JS_</TT> followed by capitalized "intercaps",
|
||||
e.g. <TT>JS_NewObject</TT>.</LI>
|
||||
|
||||
<LI>
|
||||
Extern but library-private function names use a <TT>js_</TT> prefix and
|
||||
mixed case, e.g. <TT>js_LookupSymbol</TT>.</LI>
|
||||
|
||||
<LI>
|
||||
Most static function names have unprefixed, mixed-case names: <TT>GetChar</TT>.</LI>
|
||||
|
||||
<LI>
|
||||
But static native methods of JS objects have lowercase, underscore-separated
|
||||
or intercaps names, e.g., <TT>str_indexOf</TT>.</LI>
|
||||
|
||||
<LI>
|
||||
And library-private and static data use underscores, not intercaps (but
|
||||
library-private data do use a <TT>js_</TT> prefix).</LI>
|
||||
|
||||
<LI>
|
||||
Scalar type names are lowercase and js-prefixed: <TT>jsdouble</TT>.</LI>
|
||||
|
||||
<LI>
|
||||
Aggregate type names are JS-prefixed and mixed-case: <TT>JSObject.</TT></LI>
|
||||
|
||||
<LI>
|
||||
Macros are generally <TT>ALL_CAPS </TT>and underscored, to call out potential
|
||||
side effects, multiple uses of a formal argument, etc. - Four spaces of
|
||||
indentation per statement nesting level.</LI>
|
||||
|
||||
<LI>
|
||||
Tabs are taken to be eight spaces, and an Emacs magic comment at the top
|
||||
of each file tries to help. If you're using MSVC or similar, you'll want
|
||||
to set tab width to 8, or convert these files to be space-filled.</LI>
|
||||
|
||||
<LI>
|
||||
DLL entry points have their return type expanded within a <TT>JS_PUBLIC_API()</TT>
|
||||
macro call, to get the right Windows secret type qualifiers in the right
|
||||
places for both 16- and 32-bit builds.</LI>
|
||||
|
||||
<LI>
|
||||
Callback functions that might be called from a DLL are similarly macroized
|
||||
with <TT>JS_STATIC_DLL_CALLBACK</TT> (if the function otherwise would be
|
||||
static to hide its name) or <TT>JS_DLL_CALLBACK</TT> (this macro takes
|
||||
no type argument; it should be used after the return type and before the
|
||||
function name).</LI>
|
||||
</UL>
|
||||
|
||||
<H2>
|
||||
Using the JS API</H2>
|
||||
|
||||
<H4>
|
||||
Starting up</H4>
|
||||
|
||||
<PRE><TT> /*
|
||||
* Tune this to avoid wasting space for shallow stacks, while saving on
|
||||
* malloc overhead/fragmentation for deep or highly-variable stacks.
|
||||
*/
|
||||
#define STACK_CHUNK_SIZE 8192
|
||||
|
||||
JSRuntime *rt;
|
||||
JSContext *cx;
|
||||
|
||||
/* You need a runtime and one or more contexts to do anything with JS. */
|
||||
rt = JS_Init(1000000L);
|
||||
if (!rt)
|
||||
fail("can't create JavaScript runtime");
|
||||
cx = JS_NewContext(rt, STACK_CHUNK_SIZE);
|
||||
if (!cx)
|
||||
fail("can't create JavaScript context");
|
||||
|
||||
/*
|
||||
* The context definitely wants a global object, in order to have standard
|
||||
* classes and functions like Date and parseInt. See below for details on
|
||||
* JS_NewObject.
|
||||
*/
|
||||
JSObject *globalObj;
|
||||
|
||||
globalObj = JS_NewObject(cx, &my_global_class, 0, 0);
|
||||
JS_InitStandardClasses(cx, globalObj);</TT></PRE>
|
||||
|
||||
<H4>
|
||||
Defining objects and properties</H4>
|
||||
|
||||
<PRE><TT> /* Statically initialize a class to make "one-off" objects. */
|
||||
JSClass my_class = {
|
||||
"MyClass",
|
||||
|
||||
/* All of these can be replaced with the corresponding JS_*Stub
|
||||
function pointers. */
|
||||
my_addProperty, my_delProperty, my_getProperty, my_setProperty,
|
||||
my_enumerate, my_resolve, my_convert, my_finalize
|
||||
};
|
||||
|
||||
JSObject *obj;
|
||||
|
||||
/*
|
||||
* Define an object named in the global scope that can be enumerated by
|
||||
* for/in loops. The parent object is passed as the second argument, as
|
||||
* with all other API calls that take an object/name pair. The prototype
|
||||
* passed in is null, so the default object prototype will be used.
|
||||
*/
|
||||
obj = JS_DefineObject(cx, globalObj, "myObject", &my_class, 0,
|
||||
JSPROP_ENUMERATE);
|
||||
|
||||
/*
|
||||
* Define a bunch of properties with a JSPropertySpec array statically
|
||||
* initialized and terminated with a null-name entry. Besides its name,
|
||||
* each property has a "tiny" identifier (MY_COLOR, e.g.) that can be used
|
||||
* in switch statements (in a common my_getProperty function, for example).
|
||||
*/
|
||||
enum my_tinyid {
|
||||
MY_COLOR, MY_HEIGHT, MY_WIDTH, MY_FUNNY, MY_ARRAY, MY_RDONLY
|
||||
};
|
||||
|
||||
static JSPropertySpec my_props[] = {
|
||||
{"color", MY_COLOR, JSPROP_ENUMERATE},
|
||||
{"height", MY_HEIGHT, JSPROP_ENUMERATE},
|
||||
{"width", MY_WIDTH, JSPROP_ENUMERATE},
|
||||
{"funny", MY_FUNNY, JSPROP_ENUMERATE},
|
||||
{"array", MY_ARRAY, JSPROP_ENUMERATE},
|
||||
{"rdonly", MY_RDONLY, JSPROP_READONLY},
|
||||
{0}
|
||||
};
|
||||
|
||||
JS_DefineProperties(cx, obj, my_props);
|
||||
|
||||
/*
|
||||
* Given the above definitions and call to JS_DefineProperties, obj will
|
||||
* need this sort of "getter" method in its class (my_class, above). See
|
||||
* the example for the "It" class in js.c.
|
||||
*/
|
||||
static JSBool
|
||||
my_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
switch (JSVAL_TO_INT(id)) {
|
||||
case MY_COLOR: *vp = . . .; break;
|
||||
case MY_HEIGHT: *vp = . . .; break;
|
||||
case MY_WIDTH: *vp = . . .; break;
|
||||
case MY_FUNNY: *vp = . . .; break;
|
||||
case MY_ARRAY: *vp = . . .; break;
|
||||
case MY_RDONLY: *vp = . . .; break;
|
||||
}
|
||||
}
|
||||
return JS_TRUE;
|
||||
}</TT></PRE>
|
||||
|
||||
<H4>
|
||||
Defining functions</H4>
|
||||
|
||||
<PRE><TT> /* Define a bunch of native functions first: */
|
||||
static JSBool
|
||||
my_abs(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
jsdouble x, z;
|
||||
|
||||
if (!JS_ValueToNumber(cx, argv[0], &x))
|
||||
return JS_FALSE;
|
||||
z = (x < 0) ? -x : x;
|
||||
return JS_NewDoubleValue(cx, z, rval);
|
||||
}
|
||||
|
||||
. . .
|
||||
|
||||
/*
|
||||
* Use a JSFunctionSpec array terminated with a null name to define a
|
||||
* bunch of native functions.
|
||||
*/
|
||||
static JSFunctionSpec my_functions[] = {
|
||||
/* name native nargs */
|
||||
{"abs", my_abs, 1},
|
||||
{"acos", my_acos, 1},
|
||||
{"asin", my_asin, 1},
|
||||
. . .
|
||||
{0}
|
||||
};
|
||||
|
||||
/*
|
||||
* Pass a particular object to define methods for it alone. If you pass
|
||||
* a prototype object, the methods will apply to all instances past and
|
||||
* future of the prototype's class (see below for classes).
|
||||
*/
|
||||
JS_DefineFunctions(cx, globalObj, my_functions);</TT></PRE>
|
||||
|
||||
<H4>
|
||||
Defining classes</H4>
|
||||
|
||||
<PRE><TT> /*
|
||||
* This pulls together the above API elements by defining a constructor
|
||||
* function, a prototype object, and properties of the prototype and of
|
||||
* the constructor, all with one API call.
|
||||
*
|
||||
* Initialize a class by defining its constructor function, prototype, and
|
||||
* per-instance and per-class properties. The latter are called "static"
|
||||
* below by analogy to Java. They are defined in the constructor object's
|
||||
* scope, so that 'MyClass.myStaticProp' works along with 'new MyClass()'.
|
||||
*
|
||||
* JS_InitClass takes a lot of arguments, but you can pass null for any of
|
||||
* the last four if there are no such properties or methods.
|
||||
*
|
||||
* Note that you do not need to call JS_InitClass to make a new instance of
|
||||
* that class -- otherwise there would be a chicken-and-egg problem making
|
||||
* the global object -- but you should call JS_InitClass if you require a
|
||||
* constructor function for script authors to call via new, and/or a class
|
||||
* prototype object ('MyClass.prototype') for authors to extend with new
|
||||
* properties at run-time.
|
||||
*/
|
||||
protoObj = JS_InitClass(cx, globalObj, &my_class,
|
||||
|
||||
/* native constructor function and min arg count */
|
||||
MyClass, 0,
|
||||
|
||||
/* prototype object properties and methods -- these
|
||||
will be "inherited" by all instances through
|
||||
delegation up the instance's prototype link. */
|
||||
my_props, my_methods,
|
||||
|
||||
/* class constructor properties and methods */
|
||||
my_static_props, my_static_methods);</TT></PRE>
|
||||
|
||||
<H4>
|
||||
Running scripts</H4>
|
||||
|
||||
<PRE><TT> /* These should indicate source location for diagnostics. */
|
||||
char *filename;
|
||||
uintN lineno;
|
||||
|
||||
/*
|
||||
* The return value comes back here -- if it could be a GC thing, you must
|
||||
* add it to the GC's "root set" with JS_AddRoot(cx, &thing) where thing
|
||||
* is a JSString *, JSObject *, or jsdouble *, and remove the root before
|
||||
* rval goes out of scope, or when rval is no longer needed.
|
||||
*/
|
||||
jsval rval;
|
||||
JSBool ok;
|
||||
|
||||
/*
|
||||
* Some example source in a C string. Larger, non-null-terminated buffers
|
||||
* can be used, if you pass the buffer length to JS_EvaluateScript.
|
||||
*/
|
||||
char *source = "x * f(y)";
|
||||
|
||||
ok = JS_EvaluateScript(cx, globalObj, source, strlen(source),
|
||||
filename, lineno, &rval);
|
||||
|
||||
if (ok) {
|
||||
/* Should get a number back from the example source. */
|
||||
jsdouble d;
|
||||
|
||||
ok = JS_ValueToNumber(cx, rval, &d);
|
||||
. . .
|
||||
}</TT></PRE>
|
||||
|
||||
<H4>
|
||||
Calling functions</H4>
|
||||
|
||||
<PRE><TT> /* Call a global function named "foo" that takes no arguments. */
|
||||
ok = JS_CallFunctionName(cx, globalObj, "foo", 0, 0, &rval);
|
||||
|
||||
jsval argv[2];
|
||||
|
||||
/* Call a function in obj's scope named "method", passing two arguments. */
|
||||
argv[0] = . . .;
|
||||
argv[1] = . . .;
|
||||
ok = JS_CallFunctionName(cx, obj, "method", 2, argv, &rval);</TT></PRE>
|
||||
|
||||
<H4>
|
||||
Shutting down</H4>
|
||||
|
||||
<PRE><TT> /* For each context you've created: */
|
||||
JS_DestroyContext(cx);
|
||||
|
||||
/* And finally: */
|
||||
JS_Finish(rt);</TT></PRE>
|
||||
|
||||
<H4>
|
||||
Debugging API</H4>
|
||||
See the<TT> trap, untrap, watch, unwatch, line2pc</TT>, and <TT>pc2line</TT>
|
||||
commands in <TT>js.c</TT>. Also the (scant) comments in <I>jsdbgapi.h</I>.
|
||||
<H2>
|
||||
Design walk-through</H2>
|
||||
This section must be brief for now -- it could easily turn into a book.
|
||||
<H4>
|
||||
JS "JavaScript Proper"</H4>
|
||||
JS modules declare and implement the JavaScript compiler, interpreter,
|
||||
decompiler, GC and atom manager, and standard classes.
|
||||
<P>JavaScript uses untyped bytecode and runtime type tagging of data values.
|
||||
The <TT>jsval</TT> type is a signed machine word that contains either a
|
||||
signed integer value (if the low bit is set), or a type-tagged pointer
|
||||
or boolean value (if the low bit is clear). Tagged pointers all refer to
|
||||
8-byte-aligned things in the GC heap.
|
||||
<P>Objects consist of a possibly shared structural description, called
|
||||
the map or scope; and unshared property values in a vector, called the
|
||||
slots. Object properties are associated with nonnegative integers stored
|
||||
in <TT>jsval</TT>'s, or with atoms (unique string descriptors) if named
|
||||
by an identifier or a non-integral index expression.
|
||||
<P>Scripts contain bytecode, source annotations, and a pool of string,
|
||||
number, and identifier literals. Functions are objects that extend scripts
|
||||
or native functions with formal parameters, a literal syntax, and a distinct
|
||||
primitive type ("function").
|
||||
<P>The compiler consists of a recursive-descent parser and a random-logic
|
||||
rather than table-driven lexical scanner. Semantic and lexical feedback
|
||||
are used to disambiguate hard cases such as missing semicolons, assignable
|
||||
expressions ("lvalues" in C parlance), etc. The parser generates bytecode
|
||||
as it parses, using fixup lists for downward branches and code buffering
|
||||
and rewriting for exceptional cases such as for loops. It attempts no error
|
||||
recovery. The interpreter executes the bytecode of top-level scripts, and
|
||||
calls itself indirectly to interpret function bodies (which are also scripts).
|
||||
All state associated with an interpreter instance is passed through formal
|
||||
parameters to the interpreter entry point; most implicit state is collected
|
||||
in a type named JSContext. Therefore, all API and almost all other functions
|
||||
in JSRef take a JSContext pointer as their first argument.
|
||||
<P>The decompiler translates postfix bytecode into infix source by consulting
|
||||
a separate byte-sized code, called source notes, to disambiguate bytecodes
|
||||
that result from more than one grammatical production.
|
||||
<P>The GC is a mark-and-sweep, non-conservative (perfect) collector. It
|
||||
can allocate only fixed-sized things -- the current size is two machine
|
||||
words. It is used to hold JS object and string descriptors (but not property
|
||||
lists or string bytes), and double-precision floating point numbers. It
|
||||
runs automatically only when maxbytes (as passed to <TT>JS_Init()</TT>)
|
||||
bytes of GC things have been allocated and another thing-allocation request
|
||||
is made. JS API users should call <TT>JS_GC()</TT> or <TT>JS_MaybeGC()</TT>
|
||||
between script executions or from the branch callback, as often as necessary.
|
||||
<P>An important point about the GC's "perfection": you must add roots for
|
||||
new objects created by your native methods if you store references to them
|
||||
into a non-JS structure in the malloc heap or in static data. Also, if
|
||||
you make a new object in a native method, but do not store it through the
|
||||
<TT>rval</TT> result parameter (see math_abs in the "Using the JS API"
|
||||
section above) so that it is in a known root, the object is guaranteed
|
||||
to survive only until another new object is created. Either lock the first
|
||||
new object when making two in a row, or store it in a root you've added,
|
||||
or store it via rval.
|
||||
<P>The atom manager consists of a hash table associating strings uniquely
|
||||
with scanner/parser information such as keyword type, index in script or
|
||||
function literal pool, etc. Atoms play three roles in JSRef: as literals
|
||||
referred to by unaligned 16-bit immediate bytecode operands, as unique
|
||||
string descriptors for efficient property name hashing, and as members
|
||||
of the root GC set for perfect GC. This design therefore requires atoms
|
||||
to be manually reference counted, from script literal pools (<TT>JSAtomMap</TT>)
|
||||
and object symbol (<TT>JSSymbol</TT>) entry keys.
|
||||
<P>Native objects and methods for arrays, booleans, dates, functions, numbers,
|
||||
and strings are implemented using the JS API and certain internal interfaces
|
||||
used as "fast paths".
|
||||
<P>In general, errors are signaled by false or unoverloaded-null return
|
||||
values, and are reported using <TT>JS_ReportError()</TT> or one of its
|
||||
variants by the lowest level in order to provide the most detail. Client
|
||||
code can substitute its own error reporting function and suppress errors,
|
||||
or reflect them into Java or some other runtime system as exceptions, GUI
|
||||
dialogs, etc..
|
||||
<H2>
|
||||
File walk-through</H2>
|
||||
|
||||
<H4>
|
||||
jsapi.c, jsapi.h</H4>
|
||||
The public API to be used by almost all client code. If your client
|
||||
code can't make do with <TT>jsapi.h</TT>, and must reach into a friend
|
||||
or private js* file, please let us know so we can extend <TT>jsapi.h</TT>
|
||||
to include what you need in a fashion that we can support over the long
|
||||
run.
|
||||
<H4>
|
||||
jspubtd.h, jsprvtd.h</H4>
|
||||
These files exist to group struct and scalar typedefs so they can be used
|
||||
everywhere without dragging in struct definitions from N different files.
|
||||
The <TT>jspubtd.h</TT> file contains public typedefs, and is included by
|
||||
<TT>jsapi.h</TT>. The <TT>jsprvtd.h</TT> file contains private typedefs
|
||||
and is included by various .h files that need type names, but not type
|
||||
sizes or declarations.
|
||||
<H4>
|
||||
jsdbgapi.c, jsdbgapi.h</H4>
|
||||
The Debugging API, still very much under development. Provided so far:
|
||||
<UL>
|
||||
<LI>
|
||||
Traps, with which breakpoints, single-stepping, step over, step out, and
|
||||
so on can be implemented. The debugger will have to consult jsopcode.def
|
||||
on its own to figure out where to plant trap instructions to implement
|
||||
functions like step out, but a future jsdbgapi.h will provide convenience
|
||||
interfaces to do these things. At most one trap per bytecode can be set.
|
||||
When a script (<TT>JSScript</TT>) is destroyed, all traps set in its bytecode
|
||||
are cleared.</LI>
|
||||
|
||||
<LI>
|
||||
Watchpoints, for intercepting set operations on properties and running
|
||||
a debugger-supplied function that receives the old value and a pointer
|
||||
to the new one, which it can use to modify the new value being set.</LI>
|
||||
|
||||
<LI>
|
||||
Line number to PC and back mapping functions. The line-to-PC direction
|
||||
"rounds" toward the next bytecode generated from a line greater than or
|
||||
equal to the input line, and may return the PC of a for-loop update part,
|
||||
if given the line number of the loop body's closing brace. Any line after
|
||||
the last one in a script or function maps to a PC one byte beyond the last
|
||||
bytecode in the script. An example, from perfect.js:</LI>
|
||||
|
||||
<PRE><TT>14 function perfect(n)
|
||||
15 {
|
||||
16 print("The perfect numbers up to " + n + " are:");
|
||||
17
|
||||
18 // We build sumOfDivisors[i] to hold a string expression for
|
||||
19 // the sum of the divisors of i, excluding i itself.
|
||||
20 var sumOfDivisors = new ExprArray(n+1,1);
|
||||
21 for (var divisor = 2; divisor <= n; divisor++) {
|
||||
22 for (var j = divisor + divisor; j <= n; j += divisor) {
|
||||
23 sumOfDivisors[j] += " + " + divisor;
|
||||
24 }
|
||||
25 // At this point everything up to 'divisor' has its sumOfDivisors
|
||||
26 // expression calculated, so we can determine whether it's perfect
|
||||
27 // already by evaluating.
|
||||
28 if (eval(sumOfDivisors[divisor]) == divisor) {
|
||||
29 print("" + divisor + " = " + sumOfDivisors[divisor]);
|
||||
30 }
|
||||
31 }
|
||||
32 delete sumOfDivisors;
|
||||
33 print("That's all.");
|
||||
34 }</TT></PRE>
|
||||
The line number to PC and back mappings can be tested using the js program
|
||||
with the following script:
|
||||
<PRE><TT> load("perfect.js")
|
||||
print(perfect)
|
||||
dis(perfect)
|
||||
|
||||
print()
|
||||
for (var ln = 0; ln <= 40; ln++) {
|
||||
var pc = line2pc(perfect,ln)
|
||||
var ln2 = pc2line(perfect,pc)
|
||||
print("\tline " + ln + " => pc " + pc + " => line " + ln2)
|
||||
}</TT></PRE>
|
||||
The result of the for loop over lines 0 to 40 inclusive is:
|
||||
<PRE><TT> line 0 => pc 0 => line 16
|
||||
line 1 => pc 0 => line 16
|
||||
line 2 => pc 0 => line 16
|
||||
line 3 => pc 0 => line 16
|
||||
line 4 => pc 0 => line 16
|
||||
line 5 => pc 0 => line 16
|
||||
line 6 => pc 0 => line 16
|
||||
line 7 => pc 0 => line 16
|
||||
line 8 => pc 0 => line 16
|
||||
line 9 => pc 0 => line 16
|
||||
line 10 => pc 0 => line 16
|
||||
line 11 => pc 0 => line 16
|
||||
line 12 => pc 0 => line 16
|
||||
line 13 => pc 0 => line 16
|
||||
line 14 => pc 0 => line 16
|
||||
line 15 => pc 0 => line 16
|
||||
line 16 => pc 0 => line 16
|
||||
line 17 => pc 19 => line 20
|
||||
line 18 => pc 19 => line 20
|
||||
line 19 => pc 19 => line 20
|
||||
line 20 => pc 19 => line 20
|
||||
line 21 => pc 36 => line 21
|
||||
line 22 => pc 53 => line 22
|
||||
line 23 => pc 74 => line 23
|
||||
line 24 => pc 92 => line 22
|
||||
line 25 => pc 106 => line 28
|
||||
line 26 => pc 106 => line 28
|
||||
line 27 => pc 106 => line 28
|
||||
line 28 => pc 106 => line 28
|
||||
line 29 => pc 127 => line 29
|
||||
line 30 => pc 154 => line 21
|
||||
line 31 => pc 154 => line 21
|
||||
line 32 => pc 161 => line 32
|
||||
line 33 => pc 172 => line 33
|
||||
line 34 => pc 172 => line 33
|
||||
line 35 => pc 172 => line 33
|
||||
line 36 => pc 172 => line 33
|
||||
line 37 => pc 172 => line 33
|
||||
line 38 => pc 172 => line 33
|
||||
line 39 => pc 172 => line 33
|
||||
line 40 => pc 172 => line 33</TT></PRE>
|
||||
</UL>
|
||||
|
||||
<H4>
|
||||
jsconfig.h</H4>
|
||||
Various configuration macros defined as 0 or 1 depending on how <TT>JS_VERSION</TT>
|
||||
is defined (as 10 for JavaScript 1.0, 11 for JavaScript 1.1, etc.). Not
|
||||
all macros are tested around related code yet. In particular, JS 1.0 support
|
||||
is missing from JSRef. JS 1.2 support will appear in a future JSRef release.
|
||||
<BR>
|
||||
<H4>
|
||||
js.c</H4>
|
||||
The "JS shell", a simple interpreter program that uses the JS API and more
|
||||
than a few internal interfaces (some of these internal interfaces could
|
||||
be replaced by <TT>jsapi.h</TT> calls). The js program built from this
|
||||
source provides a test vehicle for evaluating scripts and calling functions,
|
||||
trying out new debugger primitives, etc.
|
||||
<H4>
|
||||
jsarray.*, jsbool.*, jdsdate.*, jsfun.*, jsmath.*, jsnum.*, jsstr.*</H4>
|
||||
These file pairs implement the standard classes and (where they exist)
|
||||
their underlying primitive types. They have similar structure, generally
|
||||
starting with class definitions and continuing with internal constructors,
|
||||
finalizers, and helper functions.
|
||||
<H4>
|
||||
jsobj.*, jsscope.*</H4>
|
||||
These two pairs declare and implement the JS object system. All of the
|
||||
following happen here:
|
||||
<UL>
|
||||
<LI>
|
||||
creating objects by class and prototype, and finalizing objects;</LI>
|
||||
|
||||
<LI>
|
||||
defining, looking up, getting, setting, and deleting properties;</LI>
|
||||
|
||||
<LI>
|
||||
creating and destroying properties and binding names to them.</LI>
|
||||
</UL>
|
||||
The details of an object map (scope) are mostly hidden in <TT>jsscope.[ch]</TT>,
|
||||
where scopes start out as linked lists of symbols, and grow after some
|
||||
threshold into PR hash tables.
|
||||
<H4>
|
||||
jsatom.c, jsatom.h</H4>
|
||||
The atom manager. Contains well-known string constants, their atoms, the
|
||||
global atom hash table and related state, the js_Atomize() function that
|
||||
turns a counted string of bytes into an atom, and literal pool (<TT>JSAtomMap</TT>)
|
||||
methods.
|
||||
<H4>
|
||||
jsgc.c, jsgc.h</H4>
|
||||
[TBD]
|
||||
<H4>
|
||||
jsinterp.*, jscntxt.*</H4>
|
||||
The bytecode interpreter, and related functions such as Call and AllocStack,
|
||||
live in <I>jsinterp.c</I>. The JSContext constructor and destructor are
|
||||
factored out into <I>jscntxt.c</I> for minimal linking when the compiler
|
||||
part of JS is split from the interpreter part into a separate program.
|
||||
<H4>
|
||||
jsemit.*, jsopcode.tbl, jsopcode.*, jsparse.*, jsscan.*, jsscript.*</H4>
|
||||
Compiler and decompiler modules. The <I>jsopcode.tbl</I> file is a C preprocessor
|
||||
source that defines almost everything there is to know about JS bytecodes.
|
||||
See its major comment for how to use it. For now, a debugger will use it
|
||||
and its dependents such as <I>jsopcode.h</I> directly, but over time we
|
||||
intend to extend <I>jsdbgapi.h</I> to hide uninteresting details and provide
|
||||
conveniences. The code generator is split across paragraphs of code in
|
||||
<I>jsparse.c</I>, and the utility methods called on <TT>JSCodeGenerator</TT>
|
||||
appear in <I>jsemit.c</I>. Source notes generated by <I>jsparse.c</I> and
|
||||
<I>jsemit.c</I> are used in <I>jsscript.c</I> to map line number to program
|
||||
counter and back.
|
||||
<H4>
|
||||
jstypes.h, jslog2.c</H4>
|
||||
Fundamental representation types and utility macros. This file alone among
|
||||
all .h files in JSRef must be included first by .c files. It is not nested
|
||||
in .h files, as other prerequisite .h files generally are, since it is
|
||||
also a direct dependency of most .c files and would be over-included if
|
||||
nested in addition to being directly included. The one "not-quite-a-macro
|
||||
macro" is the <TT>JS_CeilingLog2()</TT> function in <I>jslog2.c</I>.
|
||||
<H4>
|
||||
jsarena.c, jsarena.h</H4>
|
||||
Last-In-First-Out allocation macros that amortize malloc costs and allow
|
||||
for en-masse freeing. See the paper mentioned in prarena.h's major comment.
|
||||
<H4>
|
||||
jsutil.c, jsutil.h</H4>
|
||||
The <TT>JS_ASSERT</TT> macro is used throughout JSRef source as a proof
|
||||
device to make invariants and preconditions clear to the reader, and to
|
||||
hold the line during maintenance and evolution against regressions or violations
|
||||
of assumptions that it would be too expensive to test unconditionally at
|
||||
run-time. Certain assertions are followed by run-time tests that cope with
|
||||
assertion failure, but only where I'm too smart or paranoid to believe
|
||||
the assertion will never fail...
|
||||
<H4>
|
||||
jsclist.h</H4>
|
||||
Doubly-linked circular list struct and macros.
|
||||
<H4>
|
||||
jscpucfg.c</H4>
|
||||
This standalone program generates <I>jscpucfg.h</I>, a header file containing
|
||||
bytes per word and other constants that depend on CPU architecture and
|
||||
C compiler type model. It tries to discover most of these constants by
|
||||
running its own experiments on the build host, so if you are cross-compiling,
|
||||
beware.
|
||||
<H4>
|
||||
prdtoa.c, prdtoa.h</H4>
|
||||
David Gay's portable double-precision floating point to string conversion
|
||||
code, with Permission To Use notice included.
|
||||
<H4>
|
||||
prhash.c, prhash.h</H4>
|
||||
Portable, extensible hash tables. These use multiplicative hash for strength
|
||||
reduction over division hash, yet with very good key distribution over
|
||||
power of two table sizes. Collisions resolve via chaining, so each entry
|
||||
burns a malloc and can fragment the heap.
|
||||
<H4>
|
||||
prlong.c, prlong.h</H4>
|
||||
64-bit integer emulation, and compatible macros that use C's long long
|
||||
type where it exists (my last company mapped long long to a 128-bit type,
|
||||
but no real architecture does 128-bit ints yet).
|
||||
<H4>
|
||||
jsosdep.h</H4>
|
||||
Annoying OS dependencies rationalized into a few "feature-test" macros
|
||||
such as <TT>HAVE_LONG_LONG</TT>.
|
||||
<H4>
|
||||
jsprf.*</H4>
|
||||
Portable, buffer-overrun-resistant sprintf and friends. For no good reason
|
||||
save lack of time, the %e, %f, and %g formats cause your system's native
|
||||
sprintf, rather than <TT>JS_dtoa()</TT>, to be used. This bug doesn't affect
|
||||
JSRef, because it uses its own <TT>JS_dtoa()</TT> call in <I>jsnum.c</I>
|
||||
to convert from double to string, but it's a bug that we'll fix later,
|
||||
and one you should be aware of if you intend to use a <TT>JS_*printf()</TT>
|
||||
function with your own floating type arguments - various vendor sprintf's
|
||||
mishandle NaN, +/-Inf, and some even print normal floating values inaccurately.
|
||||
<H4>
|
||||
prmjtime.c, prmjtime.h</H4>
|
||||
Time functions. These interfaces are named in a way that makes local vs.
|
||||
universal time confusion likely. Caveat emptor, and we're working on it.
|
||||
To make matters worse, Java (and therefore JavaScript) uses "local" time
|
||||
numbers (offsets from the epoch) in its Date class.
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -1,65 +0,0 @@
|
||||
ifdef JS_DIST
|
||||
DIST = $(JS_DIST)
|
||||
else
|
||||
DIST = $(DEPTH)/../../dist/$(OBJDIR)
|
||||
endif
|
||||
|
||||
# Set os+release dependent make variables
|
||||
OS_ARCH := $(subst /,_,$(shell uname -s))
|
||||
|
||||
# Attempt to differentiate between SunOS 5.4 and x86 5.4
|
||||
OS_CPUARCH := $(shell uname -m)
|
||||
ifeq ($(OS_CPUARCH),i86pc)
|
||||
OS_RELEASE := $(shell uname -r)_$(OS_CPUARCH)
|
||||
else
|
||||
ifeq ($(OS_ARCH),AIX)
|
||||
OS_RELEASE := $(shell uname -v).$(shell uname -r)
|
||||
else
|
||||
OS_RELEASE := $(shell uname -r)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Virtually all Linux versions are identical.
|
||||
# Any distinctions are handled in linux.h
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
OS_CONFIG := Linux_All
|
||||
else
|
||||
ifeq ($(OS_ARCH),dgux)
|
||||
OS_CONFIG := dgux
|
||||
else
|
||||
OS_CONFIG := $(OS_ARCH)$(OS_OBJTYPE)$(OS_RELEASE)
|
||||
endif
|
||||
endif
|
||||
|
||||
ASFLAGS =
|
||||
DEFINES =
|
||||
|
||||
ifeq ($(OS_ARCH), WINNT)
|
||||
INSTALL = nsinstall
|
||||
else
|
||||
INSTALL = $(DEPTH)/../../dist/$(OBJDIR)/bin/nsinstall
|
||||
endif
|
||||
|
||||
include $(DEPTH)/config/$(OS_CONFIG).mk
|
||||
|
||||
ifdef BUILD_OPT
|
||||
OPTIMIZER += -O
|
||||
DEFINES += -UDEBUG -DNDEBUG -UDEBUG_$(shell whoami)
|
||||
OBJDIR_TAG = _OPT
|
||||
else
|
||||
ifdef USE_MSVC
|
||||
OPTIMIZER = -Zi
|
||||
else
|
||||
OPTIMIZER = -g
|
||||
endif
|
||||
DEFINES += -DDEBUG -DDEBUG_$(shell whoami)
|
||||
OBJDIR_TAG = _DBG
|
||||
endif
|
||||
|
||||
# Name of the binary code directories
|
||||
OBJDIR = $(OS_CONFIG)$(OBJDIR_TAG).OBJ
|
||||
VPATH = $(OBJDIR)
|
||||
|
||||
# Automatic make dependencies file
|
||||
DEPENDENCIES = $(OBJDIR)/.md
|
||||
|
||||
@@ -35,9 +35,3 @@ OS_CFLAGS = -qarch=com -qinline+$(INLINES) -DXP_UNIX -DAIX -DAIXV3 -DSYSV
|
||||
OS_LIBS = -lbsd -lsvld -lm
|
||||
#-lpthreads -lc_r
|
||||
|
||||
MKSHLIB = $(LD) -bM:SRE -bh:4 -bnoentry -berok
|
||||
XLDFLAGS += -lc
|
||||
|
||||
ifdef JS_THREADSAFE
|
||||
XLDFLAGS += -lsvld
|
||||
endif
|
||||
|
||||
@@ -35,10 +35,3 @@ OS_CFLAGS = -qarch=com -qinline+$(INLINES) -DXP_UNIX -DAIX -DAIXV3 -DSYSV
|
||||
OS_LIBS = -lbsd -lsvld -lm
|
||||
#-lpthreads -lc_r
|
||||
|
||||
MKSHLIB = $(LD) -brtl -bM:SRE -bnoentry -bexpall -berok
|
||||
XLDFLAGS += -lc
|
||||
|
||||
ifdef JS_THREADSAFE
|
||||
XLDFLAGS += -ldl
|
||||
endif
|
||||
|
||||
|
||||
@@ -19,15 +19,10 @@
|
||||
# Config stuff for HPUX
|
||||
#
|
||||
|
||||
# CC = gcc
|
||||
# CCC = g++
|
||||
# CFLAGS += -Wall -Wno-format -fPIC
|
||||
|
||||
CC = cc -Ae +Z
|
||||
CCC = CC -Ae +a1 +eh +Z
|
||||
CC = gcc -Wall -Wno-format
|
||||
CCC = g++ -Wall -Wno-format
|
||||
|
||||
RANLIB = echo
|
||||
MKSHLIB = $(LD) -b
|
||||
|
||||
#.c.o:
|
||||
# $(CC) -c -MD $*.d $(CFLAGS) $<
|
||||
|
||||
@@ -19,13 +19,10 @@
|
||||
# Config stuff for HPUX
|
||||
#
|
||||
|
||||
# CC = gcc -Wall -Wno-format -fPIC
|
||||
# CCC = g++ -Wall -Wno-format -fPIC
|
||||
CC = cc -Ae +Z
|
||||
CCC = CC -Ae +a1 +eh +Z
|
||||
CC = gcc -Wall -Wno-format
|
||||
CCC = g++ -Wall -Wno-format
|
||||
|
||||
RANLIB = echo
|
||||
MKSHLIB = $(LD) -b
|
||||
|
||||
#.c.o:
|
||||
# $(CC) -c -MD $*.d $(CFLAGS) $<
|
||||
@@ -36,8 +33,6 @@ GFX_ARCH = x
|
||||
OS_CFLAGS = -DXP_UNIX -DHPUX -DSYSV -D_SVID_GETTOD
|
||||
OS_LIBS = -ldld
|
||||
|
||||
XLDFLAGS = -lpthread
|
||||
|
||||
ifeq ($(OS_RELEASE),B.10)
|
||||
PLATFORM_FLAGS += -DHPUX10 -Dhpux10
|
||||
PORT_FLAGS += -DRW_NO_OVERLOAD_SCHAR -DHAVE_MODEL_H
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for IRIX6.3
|
||||
# Config stuff for IRIX6.2
|
||||
#
|
||||
|
||||
include $(DEPTH)/config/IRIX.mk
|
||||
include config/IRIX.mk
|
||||
|
||||
@@ -19,4 +19,4 @@
|
||||
# Config stuff for IRIX6.3
|
||||
#
|
||||
|
||||
include $(DEPTH)/config/IRIX.mk
|
||||
include config/IRIX.mk
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
# Config for all versions of Linux
|
||||
#
|
||||
|
||||
CC = gcc
|
||||
CCC = g++
|
||||
CFLAGS += -Wall -Wno-format
|
||||
CC = gcc -Wall -Wno-format
|
||||
CCC = g++ -Wall -Wno-format
|
||||
|
||||
RANLIB = echo
|
||||
MKSHLIB = $(LD) -shared
|
||||
|
||||
#.c.o:
|
||||
# $(CC) -c -MD $*.d $(CFLAGS) $<
|
||||
@@ -35,7 +33,7 @@ CPU_ARCH = x86
|
||||
endif
|
||||
GFX_ARCH = x
|
||||
|
||||
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE
|
||||
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DLINUX
|
||||
OS_LIBS = -lm -lc
|
||||
|
||||
ASFLAGS += -x assembler-with-cpp
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for Data General DG/UX
|
||||
#
|
||||
|
||||
#
|
||||
# Initial DG/UX port by Marc Fraioli (fraioli@dg-rtp.dg.com)
|
||||
#
|
||||
|
||||
AS = as
|
||||
CC = gcc
|
||||
CCC = g++
|
||||
|
||||
RANLIB = echo
|
||||
MKSHLIB = $(LD) -shared -all -expect_unresolved "*"
|
||||
|
||||
#
|
||||
# _DGUX_SOURCE is needed to turn on a lot of stuff in the headers if
|
||||
# you're not using DG's compiler. It shouldn't hurt if you are.
|
||||
#
|
||||
# _POSIX4A_DRAFT10_SOURCE is needed to pick up localtime_r, used in
|
||||
# prtime.c
|
||||
#
|
||||
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DDGUX -D_DGUX_SOURCE -D_POSIX4A_DRAFT10_SOURCE -DOSF1
|
||||
OS_LIBS = -lsocket -lnsl
|
||||
|
||||
NOSUCHFILE = /no-such-file
|
||||
@@ -19,9 +19,8 @@
|
||||
# Config stuff for SunOS5.3
|
||||
#
|
||||
|
||||
CC = gcc
|
||||
CCC = g++
|
||||
CFLAGS += -Wall -Wno-format
|
||||
CC = gcc -Wall -Wno-format
|
||||
CCC = g++ -Wall -Wno-format
|
||||
|
||||
#CC = /opt/SUNWspro/SC3.0.1/bin/cc
|
||||
RANLIB = echo
|
||||
@@ -65,5 +64,3 @@ else
|
||||
ASFLAGS += -xarch=v8
|
||||
endif
|
||||
endif
|
||||
|
||||
MKSHLIB = $(LD) -G
|
||||
|
||||
@@ -23,9 +23,8 @@ ifdef NS_USE_NATIVE
|
||||
CC = cc
|
||||
CCC = CC
|
||||
else
|
||||
CC = gcc
|
||||
CCC = g++
|
||||
CFLAGS += -Wall -Wno-format
|
||||
CC = gcc -Wall -Wno-format
|
||||
CCC = g++ -Wall -Wno-format
|
||||
endif
|
||||
|
||||
RANLIB = echo
|
||||
@@ -66,5 +65,3 @@ else
|
||||
ASFLAGS += -xarch=v8
|
||||
endif
|
||||
endif
|
||||
|
||||
MKSHLIB = $(LD) -G
|
||||
|
||||
@@ -21,9 +21,8 @@
|
||||
|
||||
AS = as
|
||||
ifndef NS_USE_NATIVE
|
||||
CC = gcc
|
||||
CCC = g++
|
||||
CFLAGS += -Wall -Wno-format
|
||||
CC = gcc -Wall -Wno-format
|
||||
CCC = g++ -Wall
|
||||
else
|
||||
CC = cc
|
||||
CCC = CC
|
||||
@@ -56,7 +55,7 @@ endif
|
||||
|
||||
ifeq ($(OS_CPUARCH),sun4u)
|
||||
DEFINES += $(ULTRA_OPTIONSD)
|
||||
ifeq ($(CC),gcc)
|
||||
ifeq ($(findstring gcc,$(CC)),gcc)
|
||||
DEFINES += -Wa,$(ULTRA_OPTIONS),$(ULTRA_OPTIONSD)
|
||||
else
|
||||
ASFLAGS += $(ULTRA_OPTIONS) $(ULTRA_OPTIONSD)
|
||||
@@ -64,11 +63,9 @@ endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_CPUARCH),sun4m)
|
||||
ifeq ($(CC),gcc)
|
||||
ifeq ($(findstring gcc,$(CC)),gcc)
|
||||
DEFINES += -Wa,-xarch=v8
|
||||
else
|
||||
ASFLAGS += -xarch=v8
|
||||
endif
|
||||
endif
|
||||
|
||||
MKSHLIB = $(LD) -G
|
||||
|
||||
@@ -20,9 +20,8 @@
|
||||
#
|
||||
|
||||
AS = as
|
||||
CC = gcc
|
||||
CCC = g++
|
||||
CFLAGS += -Wall -Wno-format
|
||||
CC = gcc -Wall -Wno-format
|
||||
CCC = g++ -Wall -Wno-format
|
||||
|
||||
#CC = /opt/SUNWspro/SC3.0.1/bin/cc
|
||||
RANLIB = echo
|
||||
@@ -50,16 +49,14 @@ endif
|
||||
|
||||
ifeq ($(OS_CPUARCH),sun4u)
|
||||
ASFLAGS += $(ULTRA_OPTIONS)
|
||||
ifeq ($(CC),gcc)
|
||||
ifeq ($(findstring gcc,$(CC)),gcc)
|
||||
DEFINES += -Wa,$(ULTRA_OPTIONS)
|
||||
endif
|
||||
else
|
||||
ifeq ($(OS_CPUARCH),sun4m)
|
||||
ASFLAGS += -xarch=v8
|
||||
ifeq ($(CC),gcc)
|
||||
ifeq ($(findstring gcc,$(CC)),gcc)
|
||||
DEFINES += -Wa,-xarch=v8
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
MKSHLIB = $(LD) -G
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
#
|
||||
# Config stuff for SunOS5.5
|
||||
#
|
||||
|
||||
AS = as
|
||||
ifndef NS_USE_NATIVE
|
||||
CC = gcc
|
||||
CCC = g++
|
||||
CFLAGS += -Wall -Wno-format
|
||||
else
|
||||
CC = cc
|
||||
CCC = CC
|
||||
endif
|
||||
|
||||
RANLIB = echo
|
||||
|
||||
#.c.o:
|
||||
# $(CC) -c -MD $*.d $(CFLAGS) $<
|
||||
|
||||
CPU_ARCH = sparc
|
||||
GFX_ARCH = x
|
||||
|
||||
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -DSOLARIS -D_SVID_GETTOD
|
||||
OS_LIBS = -lsocket -lnsl -ldl
|
||||
|
||||
ASFLAGS += -P -L -K PIC -D_ASM -D__STDC__=0
|
||||
|
||||
HAVE_PURIFY = 1
|
||||
|
||||
NOSUCHFILE = /solaris-rm-f-sucks
|
||||
|
||||
ifndef JS_NO_ULTRA
|
||||
ULTRA_OPTIONS := -xarch=v8plus
|
||||
ULTRA_OPTIONSD := -DULTRA_SPARC
|
||||
else
|
||||
ULTRA_OPTIONS := -xarch=v8
|
||||
ULTRA_OPTIONSD :=
|
||||
endif
|
||||
|
||||
ifeq ($(OS_CPUARCH),sun4u)
|
||||
DEFINES += $(ULTRA_OPTIONSD)
|
||||
ifeq ($(CC),gcc)
|
||||
DEFINES += -Wa,$(ULTRA_OPTIONS),$(ULTRA_OPTIONSD)
|
||||
else
|
||||
ASFLAGS += $(ULTRA_OPTIONS) $(ULTRA_OPTIONSD)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_CPUARCH),sun4m)
|
||||
ifeq ($(CC),gcc)
|
||||
DEFINES += -Wa,-xarch=v8
|
||||
else
|
||||
ASFLAGS += -xarch=v8
|
||||
endif
|
||||
endif
|
||||
|
||||
MKSHLIB = $(LD) -G
|
||||
@@ -29,7 +29,6 @@ CPU_ARCH = x86 # XXX fixme
|
||||
GFX_ARCH = win32
|
||||
|
||||
OS_CFLAGS = -DXP_PC -DWIN32 -D_WINDOWS -D_WIN32
|
||||
JSDLL_CFLAGS = -DEXPORT_JS_API
|
||||
OS_LIBS = -lm -lc
|
||||
|
||||
PREBUILT_CPUCFG = 1
|
||||
@@ -40,15 +39,6 @@ LIB_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
|
||||
/subsystem:windows /dll /incremental:yes /debug\
|
||||
/machine:I386
|
||||
|
||||
EXE_LINK_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
|
||||
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib oldnames.lib /nologo\
|
||||
/subsystem:console /incremental:yes /debug\
|
||||
/machine:I386
|
||||
|
||||
ifdef JS_THREADSAFE
|
||||
LIB_LINK_FLAGS += $(DIST)/lib/libnspr21.lib
|
||||
endif
|
||||
|
||||
CAFEDIR = t:/cafe
|
||||
JCLASSPATH = $(CAFEDIR)/Java/Lib/classes.zip
|
||||
JAVAC = $(CAFEDIR)/Bin/sj.exe
|
||||
|
||||
30
mozilla/js/src/export.mac
Normal file
30
mozilla/js/src/export.mac
Normal file
@@ -0,0 +1,30 @@
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
jsapi.h
|
||||
jsarray.h
|
||||
jsatom.h
|
||||
jsbool.h
|
||||
jscntxt.h
|
||||
jscompat.h
|
||||
jsconfig.h
|
||||
jsdate.h
|
||||
jsdbgapi.h
|
||||
jsemit.h
|
||||
jsfun.h
|
||||
jsgc.h
|
||||
jsinterp.h
|
||||
jslock.h
|
||||
jsmath.h
|
||||
jsnum.h
|
||||
jsobj.h
|
||||
jsopcode.def
|
||||
jsopcode.h
|
||||
jsparse.h
|
||||
jsprvtd.h
|
||||
jspubtd.h
|
||||
jsregexp.h
|
||||
jsscan.h
|
||||
jsscope.h
|
||||
jsscript.h
|
||||
jsstr.h
|
||||
@@ -25,7 +25,13 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
#ifndef NSPR20
|
||||
#include "jsarena.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "plarena.h"
|
||||
*/
|
||||
#include "jsarena.h" /* Added by JSIFY */
|
||||
#endif
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsprf.h"
|
||||
@@ -68,10 +74,6 @@
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#ifdef XP_PC
|
||||
#include <io.h> /* for isatty() */
|
||||
#endif
|
||||
|
||||
#ifdef XP_MAC
|
||||
#define isatty(f) 1
|
||||
|
||||
@@ -168,24 +170,18 @@ Process(JSContext *cx, JSObject *obj, char *filename)
|
||||
}
|
||||
} while (ok && !(ts->flags & TSF_EOF) && CG_OFFSET(&cg) == 0);
|
||||
if (ok) {
|
||||
/* Clear any pending exception from previous failed compiles. */
|
||||
/*
|
||||
* Clear any pending exception, either from previous failed
|
||||
* compiles, or from the last round of execution.
|
||||
*/
|
||||
JS_ClearPendingException(cx);
|
||||
|
||||
script = js_NewScriptFromCG(cx, &cg, NULL);
|
||||
if (script) {
|
||||
JSErrorReporter older;
|
||||
|
||||
if (JS_ExecuteScript(cx, obj, script, &result) &&
|
||||
(ts->flags & TSF_INTERACTIVE) &&
|
||||
result != JSVAL_VOID) {
|
||||
/*
|
||||
* If JS_ValueToString generates an error, suppress
|
||||
* the report and print the exception below.
|
||||
*/
|
||||
older = JS_SetErrorReporter(cx, NULL);
|
||||
str = JS_ValueToString(cx, result);
|
||||
JS_SetErrorReporter(cx, older);
|
||||
|
||||
if (str)
|
||||
printf("%s\n", JS_GetStringBytes(str));
|
||||
}
|
||||
@@ -197,9 +193,10 @@ Process(JSContext *cx, JSObject *obj, char *filename)
|
||||
* Calling JS_ValueToString could cause another error (and
|
||||
* throw an associated exception) - so we disable the error
|
||||
* reporter so nothing gets reported, and we always clear
|
||||
* the pending exception.
|
||||
* the pending exception... which might be different than
|
||||
* the one we just got in &result.
|
||||
*/
|
||||
JS_ClearPendingException(cx);
|
||||
JSErrorReporter older;
|
||||
older = JS_SetErrorReporter(cx, NULL);
|
||||
str = JS_ValueToString(cx, result);
|
||||
JS_SetErrorReporter(cx, older);
|
||||
@@ -216,7 +213,7 @@ Process(JSContext *cx, JSObject *obj, char *filename)
|
||||
}
|
||||
}
|
||||
cg.firstLine = ts->lineno;
|
||||
js_FinishCodeGenerator(cx, &cg);
|
||||
js_ResetCodeGenerator(cx, &cg);
|
||||
RESET_TOKENBUF(ts);
|
||||
} while (!(ts->flags & TSF_EOF));
|
||||
|
||||
@@ -342,15 +339,12 @@ Load(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
errno = 0;
|
||||
script = JS_CompileFile(cx, obj, filename);
|
||||
if (!script)
|
||||
ok = JS_FALSE;
|
||||
else {
|
||||
ok = JS_ExecuteScript(cx, obj, script, &result);
|
||||
JS_DestroyScript(cx, script);
|
||||
}
|
||||
continue;
|
||||
ok = JS_ExecuteScript(cx, obj, script, &result);
|
||||
JS_DestroyScript(cx, script);
|
||||
if (!ok)
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
@@ -954,13 +948,6 @@ ConvertArgs(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
}
|
||||
#endif
|
||||
|
||||
static JSBool
|
||||
BuildDate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
printf("built on %s at %s\n", __DATE__, __TIME__);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSFunctionSpec shell_functions[] = {
|
||||
{"version", Version, 0},
|
||||
{"load", Load, 1},
|
||||
@@ -985,7 +972,6 @@ static JSFunctionSpec shell_functions[] = {
|
||||
#ifdef TEST_CVTARGS
|
||||
{"cvtargs", ConvertArgs, 0, 0, 12},
|
||||
#endif
|
||||
{"build", BuildDate, 0},
|
||||
{0}
|
||||
};
|
||||
|
||||
@@ -1015,7 +1001,6 @@ static char *shell_help_messages[] = {
|
||||
#ifdef TEST_CVTARGS
|
||||
"cvtargs b c ... Test JS_ConvertArguments",
|
||||
#endif
|
||||
"build Show build date and time",
|
||||
0
|
||||
};
|
||||
|
||||
@@ -1111,6 +1096,9 @@ static JSPropertySpec its_props[] = {
|
||||
* below is used as a callback for the jsdbgapi JS_SetSourceHandler hook.
|
||||
* A more normal embedding (e.g. mozilla) loads source itself and can send
|
||||
* source directly to JSD without using this hook scheme.
|
||||
*
|
||||
* XXX At some future point JSD will understand Unicode source and the
|
||||
* *very* ugly conversion below will be unnecessary.
|
||||
*/
|
||||
static void
|
||||
SendSourceToJSDebugger(const char *filename, uintN lineno,
|
||||
@@ -1133,8 +1121,26 @@ SendSourceToJSDebugger(const char *filename, uintN lineno,
|
||||
}
|
||||
}
|
||||
if (jsdsrc) {
|
||||
jsdsrc = JSD_AppendUCSourceText(jsdc,jsdsrc, str, length,
|
||||
JSD_SOURCE_PARTIAL);
|
||||
/* here we convert our Unicode into a C string to pass to JSD */
|
||||
#define JSD_BUF_SIZE 1024
|
||||
static char* buf = NULL;
|
||||
int remaining = length;
|
||||
|
||||
if (!buf)
|
||||
buf = malloc(JSD_BUF_SIZE);
|
||||
if (buf)
|
||||
{
|
||||
while (remaining && jsdsrc) {
|
||||
int bytes = JS_MIN(remaining, JSD_BUF_SIZE);
|
||||
int i;
|
||||
for (i = 0; i < bytes; i++)
|
||||
buf[i] = (const char) *(str++);
|
||||
jsdsrc = JSD_AppendSourceText(jsdc,jsdsrc,
|
||||
buf, bytes,
|
||||
JSD_SOURCE_PARTIAL);
|
||||
remaining -= bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
*listenerTSData = jsdsrc;
|
||||
}
|
||||
@@ -1271,7 +1277,7 @@ my_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
|
||||
* a toplevel compile.
|
||||
*/
|
||||
if ((JSREPORT_IS_WARNING(report->flags) && !reportWarnings) ||
|
||||
(JSREPORT_IS_EXCEPTION(report->flags))) {
|
||||
(JSREPORT_IS_EXCEPTION(report->flags) && cx->interpLevel > 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
184
mozilla/js/src/js.dsp
Normal file
184
mozilla/js/src/js.dsp
Normal file
@@ -0,0 +1,184 @@
|
||||
# Microsoft Developer Studio Project File - Name="jsshell" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 5.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=jsshell - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "js.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "js.mak" CFG="jsshell - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "jsshell - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "jsshell - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "jsshell - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir ".\jsshell_"
|
||||
# PROP BASE Intermediate_Dir ".\jsshell_"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ".\Release"
|
||||
# PROP Intermediate_Dir ".\Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "mininspr" /D "NDEBUG" /D "_CONSOLE" /D "_WIN32" /D "WIN32" /D "XP_PC" /D "_WINDOWS" /D "JSFILE" /D "MINI_NSPR" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:".\Release\jsshell.exe"
|
||||
|
||||
!ELSEIF "$(CFG)" == "jsshell - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir ".\jsshell0"
|
||||
# PROP BASE Intermediate_Dir ".\jsshell0"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ".\Debug"
|
||||
# PROP Intermediate_Dir ".\Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "mininspr" /D "_DEBUG" /D "DEBUG" /D "_CONSOLE" /D "_WIN32" /D "WIN32" /D "XP_PC" /D "_WINDOWS" /D "JSFILE" /D "MINI_NSPR" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:".\Debug\jsshell.exe"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "jsshell - Win32 Release"
|
||||
# Name "jsshell - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\js.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsapi.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsatom.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jscntxt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsdbgapi.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsemit.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsfun.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsgc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsinterp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jslock.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsobj.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsopcode.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsparse.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsprvtd.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jspubtd.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsregexp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscan.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscope.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscript.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsstddef.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsstr.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\prarena.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
56
mozilla/js/src/js.dsw
Normal file
56
mozilla/js/src/js.dsw
Normal file
@@ -0,0 +1,56 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 5.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "js32"=.\js32.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "jsshell"=.\js.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name js32
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "miniNSPR"=.\miniNSPR.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -192,14 +192,3 @@ MSG_DEF(JSMSG_RESERVED_ID, 132, 1, JSEXN_SYNTAXERR, "{0} is a reserve
|
||||
MSG_DEF(JSMSG_SYNTAX_ERROR, 133, 0, JSEXN_SYNTAXERR, "syntax error")
|
||||
MSG_DEF(JSMSG_BAD_SHARP_VAR_DEF, 134, 0, JSEXN_SYNTAXERR, "invalid sharp variable definition")
|
||||
MSG_DEF(JSMSG_BAD_PROTOTYPE, 135, 1, JSEXN_ERR, "'prototype' property of {0} is not an object")
|
||||
MSG_DEF(JSMSG_MISSING_EXPONENT, 136, 0, JSEXN_SYNTAXERR, "missing exponent")
|
||||
MSG_DEF(JSMSG_OUT_OF_MEMORY, 137, 0, JSEXN_ERR, "out of memory")
|
||||
MSG_DEF(JSMSG_UNTERMINATED_STRING, 138, 0, JSEXN_SYNTAXERR, "unterminated string literal")
|
||||
MSG_DEF(JSMSG_NESTED_COMMENT, 139, 0, JSEXN_SYNTAXERR, "nested comment")
|
||||
MSG_DEF(JSMSG_UNTERMINATED_COMMENT, 140, 0, JSEXN_SYNTAXERR, "unterminated comment")
|
||||
MSG_DEF(JSMSG_UNTERMINATED_REGEXP, 141, 0, JSEXN_SYNTAXERR, "unterminated regular expression literal")
|
||||
MSG_DEF(JSMSG_BAD_REGEXP_FLAG, 142, 0, JSEXN_SYNTAXERR, "invalid flag after regular expression")
|
||||
MSG_DEF(JSMSG_SHARPVAR_TOO_BIG, 143, 0, JSEXN_SYNTAXERR, "overlarge sharp variable number")
|
||||
MSG_DEF(JSMSG_ILLEGAL_CHARACTER, 144, 0, JSEXN_SYNTAXERR, "illegal character")
|
||||
MSG_DEF(JSMSG_BAD_OCTAL, 145, 1, JSEXN_NONE, "{0} is not a legal ECMA-262 numeric constant")
|
||||
MSG_DEF(JSMSG_BAD_INDIRECT_CALL, 146, 1, JSEXN_CALLERR, "Function {0} must be called directly, and not by way of a function of another name.")
|
||||
|
||||
318
mozilla/js/src/js32.dsp
Normal file
318
mozilla/js/src/js32.dsp
Normal file
@@ -0,0 +1,318 @@
|
||||
# Microsoft Developer Studio Project File - Name="js32" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 5.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=js32 - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "js32.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "js32.mak" CFG="js32 - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "js32 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "js32 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "js32 - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir ".\js32\Release"
|
||||
# PROP BASE Intermediate_Dir ".\js32\Release"
|
||||
# PROP BASE Target_Dir ".\js32"
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ".\Release"
|
||||
# PROP Intermediate_Dir ".\Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ".\js32"
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /I "mininspr" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32" /D "WIN32" /D "XP_PC" /D "JSFILE" /D "EXPORT_JS_API" /D "MINI_NSPR" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
||||
# ADD LINK32 H:\ns\dist\WINNT4.0_OPT.OBJ\lib\libnspr21_s.lib H:\ns\dist\WINNT4.0_OPT.OBJ\lib\libplds21_s.lib winmm.lib mswsock.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "js32 - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir ".\js32\Debug"
|
||||
# PROP BASE Intermediate_Dir ".\js32\Debug"
|
||||
# PROP BASE Target_Dir ".\js32"
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ".\Debug"
|
||||
# PROP Intermediate_Dir ".\Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ".\js32"
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "mininspr" /D "_DEBUG" /D "DEBUG" /D "_WINDOWS" /D "_WIN32" /D "WIN32" /D "XP_PC" /D "JSFILE" /D "EXPORT_JS_API" /D "MINI_NSPR" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
|
||||
# ADD LINK32 H:\ns\dist\WINNT4.0_DBG.OBJ\lib\libnspr21_s.lib H:\ns\dist\WINNT4.0_DBG.OBJ\lib\libplds21_s.lib winmm.lib mswsock.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "js32 - Win32 Release"
|
||||
# Name "js32 - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsapi.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsarray.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsatom.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsbool.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jscntxt.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsdate.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsdbgapi.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsemit.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsfun.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsgc.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsinterp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jslock.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsmath.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsnum.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsobj.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsopcode.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsparse.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsregexp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscan.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscope.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscript.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsstr.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsxdrapi.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\prarena.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\prmjtime.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsapi.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsarray.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsatom.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsbool.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jscntxt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsconfig.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsdate.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsdbgapi.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsemit.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsfun.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsgc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsinterp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jslock.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsmath.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsnum.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsobj.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsopcode.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsparse.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsprvtd.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jspubtd.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsregexp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscan.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscope.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsscript.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsstddef.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsstr.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\jsxdrapi.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\prarena.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\prdtoa.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -17,25 +17,25 @@
|
||||
* in the importing module's import address table.
|
||||
*/
|
||||
|
||||
JS_EXPORT_API(JSPropertyOp)
|
||||
IMPLEMENT(JSPropertyOp)
|
||||
js_GetArgumentAddress()
|
||||
{
|
||||
return ((void *)js_GetArgument);
|
||||
}
|
||||
|
||||
JS_EXPORT_API(JSPropertyOp)
|
||||
IMPLEMENT(JSPropertyOp)
|
||||
js_SetArgumentAddress()
|
||||
{
|
||||
return ((void *)js_SetArgument);
|
||||
}
|
||||
|
||||
JS_EXPORT_API(JSPropertyOp)
|
||||
IMPLEMENT(JSPropertyOp)
|
||||
js_GetLocalVariableAddress()
|
||||
{
|
||||
return ((void *)js_GetLocalVariable);
|
||||
}
|
||||
|
||||
JS_EXPORT_API(JSPropertyOp)
|
||||
IMPLEMENT(JSPropertyOp)
|
||||
js_SetLocalVariableAddress()
|
||||
{
|
||||
return ((void *)js_SetLocalVariable);
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
#ifndef jsaddr_h___
|
||||
#define jsaddr_h___
|
||||
|
||||
JS_EXTERN_API(JSPropertyOp)
|
||||
EXTERN(JSPropertyOp)
|
||||
js_GetArgumentAddress();
|
||||
|
||||
JS_EXTERN_API(JSPropertyOp)
|
||||
EXTERN(JSPropertyOp)
|
||||
js_SetArgumentAddress();
|
||||
|
||||
JS_EXTERN_API(JSPropertyOp)
|
||||
EXTERN(JSPropertyOp)
|
||||
js_GetLocalVariableAddress();
|
||||
|
||||
JS_EXTERN_API(JSPropertyOp)
|
||||
EXTERN(JSPropertyOp)
|
||||
js_SetLocalVariableAddress();
|
||||
|
||||
#endif /* jsaddr_h___ */
|
||||
|
||||
@@ -25,7 +25,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
#ifndef NSPR20
|
||||
#include "jsarena.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "plarena.h"
|
||||
*/
|
||||
#include "jsarena.h" /* Added by JSIFY */
|
||||
#endif
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsclist.h"
|
||||
#include "jsprf.h"
|
||||
@@ -496,7 +503,7 @@ JS_YieldRequest(JSContext *cx)
|
||||
JSRuntime *rt;
|
||||
|
||||
CHECK_REQUEST(cx);
|
||||
rt = cx->runtime;
|
||||
|
||||
JS_ASSERT(rt->requestCount > 0);
|
||||
rt->requestCount--;
|
||||
JS_NOTIFY_REQUEST_DONE(rt);
|
||||
@@ -628,7 +635,7 @@ JS_SetVersion(JSContext *cx, JSVersion version)
|
||||
JS_PUBLIC_API(const char *)
|
||||
JS_GetImplementationVersion(void)
|
||||
{
|
||||
return "JavaScript-C 1.4 1998 09 21";
|
||||
return "JavaScript-C 1.3 1998 06 30";
|
||||
}
|
||||
|
||||
|
||||
@@ -789,14 +796,20 @@ JS_AddNamedRoot(JSContext *cx, void *rp, const char *name)
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#ifndef NSPR20
|
||||
#include "jshash.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "JShash.h"
|
||||
*/
|
||||
#include "jshash.h" /* Added by JSIFY */
|
||||
#endif
|
||||
|
||||
typedef struct NamedRootDumpArgs {
|
||||
void (*dump)(const char *name, void *rp, void *data);
|
||||
void *data;
|
||||
} NamedRootDumpArgs;
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(intN)
|
||||
STATIC_DLL_CALLBACK(intN)
|
||||
js_named_root_dumper(JSHashEntry *he, intN i, void *arg)
|
||||
{
|
||||
NamedRootDumpArgs *args = arg;
|
||||
@@ -941,7 +954,8 @@ JS_ConvertStub(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
|
||||
if (type == JSTYPE_STRING)
|
||||
return JS_TRUE;
|
||||
#endif
|
||||
return js_TryValueOf(cx, obj, type, vp);
|
||||
js_TryValueOf(cx, obj, type, vp);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
@@ -985,11 +999,6 @@ JS_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto,
|
||||
if (!fun)
|
||||
goto bad;
|
||||
|
||||
#if 0
|
||||
if (clasp->construct == NULL)
|
||||
clasp->construct = constructor;
|
||||
#endif
|
||||
|
||||
/* Connect constructor and prototype by named properties. */
|
||||
ctor = fun->object;
|
||||
if (!js_SetClassPrototype(cx, ctor, proto,
|
||||
@@ -1867,10 +1876,8 @@ JS_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent)
|
||||
JSObject *newfunobj;
|
||||
|
||||
CHECK_REQUEST(cx);
|
||||
if (OBJ_GET_CLASS(cx, funobj) != &js_FunctionClass) {
|
||||
/* Indicate we cannot clone this object */
|
||||
return funobj;
|
||||
}
|
||||
if (OBJ_GET_CLASS(cx, funobj) != &js_FunctionClass)
|
||||
return NULL;
|
||||
fun = JS_GetPrivate(cx, funobj);
|
||||
|
||||
newfunobj = js_NewObject(cx, &js_FunctionClass, funobj, parent);
|
||||
@@ -1947,14 +1954,15 @@ CompileTokenStream(JSContext *cx, JSObject *obj, JSTokenStream *ts,
|
||||
goto out;
|
||||
}
|
||||
script = js_NewScriptFromCG(cx, &cg, NULL);
|
||||
out:
|
||||
if (!script)
|
||||
goto out;
|
||||
if (!js_CloseTokenStream(cx, ts)) {
|
||||
if (script)
|
||||
js_DestroyScript(cx, script);
|
||||
js_DestroyScript(cx, script);
|
||||
script = NULL;
|
||||
}
|
||||
out:
|
||||
cg.tempMark = tempMark;
|
||||
js_FinishCodeGenerator(cx, &cg);
|
||||
js_ResetCodeGenerator(cx, &cg);
|
||||
return script;
|
||||
}
|
||||
|
||||
@@ -2216,19 +2224,8 @@ JS_DecompileFunction(JSContext *cx, JSFunction *fun, uintN indent)
|
||||
JS_PUBLIC_API(JSString *)
|
||||
JS_DecompileFunctionBody(JSContext *cx, JSFunction *fun, uintN indent)
|
||||
{
|
||||
JSPrinter *jp;
|
||||
JSString *str;
|
||||
|
||||
CHECK_REQUEST(cx);
|
||||
jp = js_NewPrinter(cx, JS_GetFunctionName(fun), indent);
|
||||
if (!jp)
|
||||
return NULL;
|
||||
if (js_DecompileFunctionBody(jp, fun, JS_TRUE))
|
||||
str = js_GetPrinterOutput(jp);
|
||||
else
|
||||
str = NULL;
|
||||
js_DestroyPrinter(jp);
|
||||
return str;
|
||||
return JS_DecompileScript(cx, fun->script, JS_GetFunctionName(fun), indent);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
@@ -2523,24 +2520,11 @@ JS_ReportErrorNumber(JSContext *cx, JSErrorCallback errorCallback,
|
||||
CHECK_REQUEST(cx);
|
||||
va_start(ap, errorNumber);
|
||||
js_ReportErrorNumberVA(cx, JSREPORT_ERROR, errorCallback, userRef,
|
||||
errorNumber, JS_TRUE, ap);
|
||||
errorNumber, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_ReportErrorNumberUC(JSContext *cx, JSErrorCallback errorCallback,
|
||||
void *userRef, const uintN errorNumber, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
CHECK_REQUEST(cx);
|
||||
va_start(ap, errorNumber);
|
||||
js_ReportErrorNumberVA(cx, JSREPORT_ERROR, errorCallback, userRef,
|
||||
errorNumber, JS_FALSE, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
IMPLEMENT(void)
|
||||
JS_ReportWarning(JSContext *cx, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -2716,7 +2700,8 @@ JS_ClearContextThread(JSContext *cx)
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
JS_FRIEND_API(JSBool)
|
||||
#ifdef NETSCAPE_INTERNAL
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_IsAssigning(JSContext *cx)
|
||||
{
|
||||
JSStackFrame *fp;
|
||||
@@ -2726,6 +2711,7 @@ JS_IsAssigning(JSContext *cx)
|
||||
return JS_FALSE;
|
||||
return (js_CodeSpec[*pc].format & JOF_SET) != 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
@@ -269,10 +269,10 @@ JS_NewContext(JSRuntime *rt, size_t stacksize);
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_DestroyContext(JSContext *cx);
|
||||
|
||||
JS_EXTERN_API(void*)
|
||||
EXTERN(void*)
|
||||
JS_GetContextPrivate(JSContext *cx);
|
||||
|
||||
JS_EXTERN_API(void)
|
||||
EXTERN(void)
|
||||
JS_SetContextPrivate(JSContext *cx, void *data);
|
||||
|
||||
extern JS_PUBLIC_API(JSRuntime *)
|
||||
@@ -500,7 +500,7 @@ JS_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto,
|
||||
extern JS_PUBLIC_API(JSClass *)
|
||||
JS_GetClass(JSContext *cx, JSObject *obj);
|
||||
#else
|
||||
extern JS_PUBLIC_API(JSClass *)
|
||||
JS_PUBLIC_API(JSClass *)
|
||||
JS_GetClass(JSObject *obj);
|
||||
#endif
|
||||
|
||||
@@ -928,23 +928,16 @@ extern JS_PUBLIC_API(void)
|
||||
JS_ReportError(JSContext *cx, const char *format, ...);
|
||||
|
||||
/*
|
||||
* Use an errorNumber to retrieve the format string, args are char *
|
||||
* As above, but use an errorNumber for the format string
|
||||
*/
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_ReportErrorNumber(JSContext *cx, JSErrorCallback errorCallback,
|
||||
void *userRef, const uintN errorNumber, ...);
|
||||
|
||||
/*
|
||||
* Use an errorNumber to retrieve the format string, args are jschar *
|
||||
*/
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_ReportErrorNumberUC(JSContext *cx, JSErrorCallback errorCallback,
|
||||
void *userRef, const uintN errorNumber, ...);
|
||||
|
||||
/*
|
||||
* As above, but report a warning instead (JSREPORT_IS_WARNING(report->flags)).
|
||||
*/
|
||||
extern JS_PUBLIC_API(void)
|
||||
EXTERN(void)
|
||||
JS_ReportWarning(JSContext *cx, const char *format, ...);
|
||||
|
||||
/*
|
||||
@@ -962,8 +955,8 @@ struct JSErrorReport {
|
||||
const jschar *uctokenptr; /* unicode (original) token pointer */
|
||||
uintN flags; /* error/warning, etc. */
|
||||
uintN errorNumber; /* the error number, e.g. see js.msg */
|
||||
const jschar *ucmessage; /* the (default) error message */
|
||||
const jschar **messageArgs; /* arguments for the error message */
|
||||
JSString *ucmessage; /* the (default) error message */
|
||||
JSString **messageArgs; /* arguments for the error message */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -977,7 +970,7 @@ struct JSErrorReport {
|
||||
/*
|
||||
* If JSREPORT_EXCEPTION is set, then a JavaScript-catchable exception
|
||||
* has been thrown for this runtime error, and the host should ignore it.
|
||||
* Exception-aware hosts should also check for JS_IsExceptionPending if
|
||||
* Exception-aware hosts should also check for JS_IsPendingException if
|
||||
* JS_ExecuteScript returns failure, and signal or propagate the exception, as
|
||||
* appropriate.
|
||||
*/
|
||||
@@ -1051,15 +1044,14 @@ JS_ClearContextThread(JSContext *cx);
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#ifdef NETSCAPE_INTERNAL
|
||||
/*
|
||||
* Returns true if a script is executing and its current bytecode is a set
|
||||
* (assignment) operation.
|
||||
*
|
||||
* NOTE: Previously conditional on NETSCAPE_INTERNAL. This function may
|
||||
* be removed in the future.
|
||||
*/
|
||||
extern JS_FRIEND_API(JSBool)
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_IsAssigning(JSContext *cx);
|
||||
#endif
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
||||
|
||||
@@ -26,7 +26,14 @@
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
#include "jsbit.h"
|
||||
#ifndef NSPR20
|
||||
#include "jsarena.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "plarena.h"
|
||||
*/
|
||||
#include "jsarena.h" /* Added by JSIFY */
|
||||
#endif
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
@@ -45,7 +52,7 @@ static JSArenaStats *arena_stats_list;
|
||||
|
||||
#define JS_ARENA_DEFAULT_ALIGN sizeof(double)
|
||||
|
||||
JS_EXPORT_API(void)
|
||||
IMPLEMENT(void)
|
||||
JS_InitArenaPool(JSArenaPool *pool, const char *name, JSUint32 size, JSUint32 align)
|
||||
{
|
||||
if (align == 0)
|
||||
@@ -64,7 +71,7 @@ JS_InitArenaPool(JSArenaPool *pool, const char *name, JSUint32 size, JSUint32 al
|
||||
#endif
|
||||
}
|
||||
|
||||
JS_EXPORT_API(void *)
|
||||
IMPLEMENT(void *)
|
||||
JS_ArenaAllocate(JSArenaPool *pool, JSUint32 nb)
|
||||
{
|
||||
JSArena **ap, *a, *b;
|
||||
@@ -120,7 +127,7 @@ JS_ArenaAllocate(JSArenaPool *pool, JSUint32 nb)
|
||||
return p;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(void *)
|
||||
IMPLEMENT(void *)
|
||||
JS_ArenaGrow(JSArenaPool *pool, void *p, JSUint32 size, JSUint32 incr)
|
||||
{
|
||||
void *newp;
|
||||
@@ -182,7 +189,7 @@ FreeArenaList(JSArenaPool *pool, JSArena *head, JSBool reallyFree)
|
||||
pool->current = head;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(void)
|
||||
IMPLEMENT(void)
|
||||
JS_ArenaRelease(JSArenaPool *pool, char *mark)
|
||||
{
|
||||
JSArena *a;
|
||||
@@ -196,14 +203,14 @@ JS_ArenaRelease(JSArenaPool *pool, char *mark)
|
||||
}
|
||||
}
|
||||
|
||||
JS_EXPORT_API(void)
|
||||
IMPLEMENT(void)
|
||||
JS_FreeArenaPool(JSArenaPool *pool)
|
||||
{
|
||||
FreeArenaList(pool, &pool->first, JS_FALSE);
|
||||
COUNT(pool, ndeallocs);
|
||||
}
|
||||
|
||||
JS_EXPORT_API(void)
|
||||
IMPLEMENT(void)
|
||||
JS_FinishArenaPool(JSArenaPool *pool)
|
||||
{
|
||||
FreeArenaList(pool, &pool->first, JS_TRUE);
|
||||
@@ -224,7 +231,7 @@ JS_FinishArenaPool(JSArenaPool *pool)
|
||||
#endif
|
||||
}
|
||||
|
||||
JS_EXPORT_API(void)
|
||||
IMPLEMENT(void)
|
||||
JS_CompactArenaPool(JSArenaPool *pool)
|
||||
{
|
||||
#if 0 /* XP_MAC */
|
||||
@@ -238,7 +245,7 @@ JS_CompactArenaPool(JSArenaPool *pool)
|
||||
#endif
|
||||
}
|
||||
|
||||
JS_EXPORT_API(void)
|
||||
IMPLEMENT(void)
|
||||
JS_ArenaFinish()
|
||||
{
|
||||
JSArena *a, *next;
|
||||
@@ -260,7 +267,7 @@ JS_ArenaFinish()
|
||||
}
|
||||
|
||||
#ifdef JS_ARENAMETER
|
||||
JS_EXPORT_API(void)
|
||||
IMPLEMENT(void)
|
||||
JS_ArenaCountAllocation(JSArenaPool *pool, JSUint32 nb)
|
||||
{
|
||||
pool->stats.nallocs++;
|
||||
@@ -270,13 +277,13 @@ JS_ArenaCountAllocation(JSArenaPool *pool, JSUint32 nb)
|
||||
pool->stats.variance += nb * nb;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(void)
|
||||
IMPLEMENT(void)
|
||||
JS_ArenaCountInplaceGrowth(JSArenaPool *pool, JSUint32 size, JSUint32 incr)
|
||||
{
|
||||
pool->stats.ninplace++;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(void)
|
||||
IMPLEMENT(void)
|
||||
JS_ArenaCountGrowth(JSArenaPool *pool, JSUint32 size, JSUint32 incr)
|
||||
{
|
||||
pool->stats.ngrows++;
|
||||
@@ -288,13 +295,13 @@ JS_ArenaCountGrowth(JSArenaPool *pool, JSUint32 size, JSUint32 incr)
|
||||
pool->stats.variance += size * size;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(void)
|
||||
IMPLEMENT(void)
|
||||
JS_ArenaCountRelease(JSArenaPool *pool, char *mark)
|
||||
{
|
||||
pool->stats.nreleases++;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(void)
|
||||
IMPLEMENT(void)
|
||||
JS_ArenaCountRetract(JSArenaPool *pool, char *mark)
|
||||
{
|
||||
pool->stats.nfastrels++;
|
||||
@@ -303,7 +310,7 @@ JS_ArenaCountRetract(JSArenaPool *pool, char *mark)
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
JS_EXPORT_API(void)
|
||||
IMPLEMENT(void)
|
||||
JS_DumpArenaStats(FILE *fp)
|
||||
{
|
||||
JSArenaStats *stats;
|
||||
|
||||
@@ -167,7 +167,7 @@ struct JSArenaPool {
|
||||
* Initialize an arena pool with the given name for debugging and metering,
|
||||
* with a minimum size per arena of size bytes.
|
||||
*/
|
||||
JS_EXTERN_API(void)
|
||||
EXTERN(void)
|
||||
JS_InitArenaPool(JSArenaPool *pool, const char *name, JSUint32 size,
|
||||
JSUint32 align);
|
||||
|
||||
@@ -176,59 +176,59 @@ JS_InitArenaPool(JSArenaPool *pool, const char *name, JSUint32 size,
|
||||
* after calling this function. There is no need to call JS_InitArenaPool()
|
||||
* again unless JS_FinishArenaPool(pool) has been called.
|
||||
*/
|
||||
JS_EXTERN_API(void)
|
||||
EXTERN(void)
|
||||
JS_FreeArenaPool(JSArenaPool *pool);
|
||||
|
||||
/*
|
||||
* Free the arenas in pool and finish using it altogether.
|
||||
*/
|
||||
JS_EXTERN_API(void)
|
||||
EXTERN(void)
|
||||
JS_FinishArenaPool(JSArenaPool *pool);
|
||||
|
||||
/*
|
||||
* Compact all of the arenas in a pool so that no space is wasted.
|
||||
*/
|
||||
JS_EXTERN_API(void)
|
||||
EXTERN(void)
|
||||
JS_CompactArenaPool(JSArenaPool *pool);
|
||||
|
||||
/*
|
||||
* Finish using arenas, freeing all memory associated with them.
|
||||
*/
|
||||
JS_EXTERN_API(void)
|
||||
EXTERN(void)
|
||||
JS_ArenaFinish(void);
|
||||
|
||||
/*
|
||||
* Friend functions used by the JS_ARENA_*() macros.
|
||||
*/
|
||||
JS_EXTERN_API(void *)
|
||||
EXTERN(void *)
|
||||
JS_ArenaAllocate(JSArenaPool *pool, JSUint32 nb);
|
||||
|
||||
JS_EXTERN_API(void *)
|
||||
EXTERN(void *)
|
||||
JS_ArenaGrow(JSArenaPool *pool, void *p, JSUint32 size, JSUint32 incr);
|
||||
|
||||
JS_EXTERN_API(void)
|
||||
EXTERN(void)
|
||||
JS_ArenaRelease(JSArenaPool *pool, char *mark);
|
||||
|
||||
#ifdef JS_ARENAMETER
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
JS_EXTERN_API(void)
|
||||
EXTERN(void)
|
||||
JS_ArenaCountAllocation(JSArenaPool *pool, JSUint32 nb);
|
||||
|
||||
JS_EXTERN_API(void)
|
||||
EXTERN(void)
|
||||
JS_ArenaCountInplaceGrowth(JSArenaPool *pool, JSUint32 size, JSUint32 incr);
|
||||
|
||||
JS_EXTERN_API(void)
|
||||
EXTERN(void)
|
||||
JS_ArenaCountGrowth(JSArenaPool *pool, JSUint32 size, JSUint32incr);
|
||||
|
||||
JS_EXTERN_API(void)
|
||||
EXTERN(void)
|
||||
JS_ArenaCountRelease(JSArenaPool *pool, char *mark);
|
||||
|
||||
JS_EXTERN_API(void)
|
||||
EXTERN(void)
|
||||
JS_ArenaCountRetract(JSArenaPool *pool, char *mark);
|
||||
|
||||
JS_EXTERN_API(void)
|
||||
EXTERN(void)
|
||||
JS_DumpArenaStats(FILE *fp);
|
||||
|
||||
#else /* !JS_ARENAMETER */
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsapi.h"
|
||||
#include "jsarray.h"
|
||||
@@ -297,7 +298,8 @@ array_convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
|
||||
return JS_TRUE;
|
||||
}
|
||||
}
|
||||
return js_TryValueOf(cx, obj, type, vp);
|
||||
js_TryValueOf(cx, obj, type, vp);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSClass js_ArrayClass = {
|
||||
|
||||
@@ -23,8 +23,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#ifndef NSPR20
|
||||
#include "jshash.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "JShash.h"
|
||||
*/
|
||||
#include "jshash.h" /* Added by JSIFY */
|
||||
#endif
|
||||
#include "jsprf.h"
|
||||
#include "jsapi.h"
|
||||
#include "jsatom.h"
|
||||
@@ -81,7 +88,7 @@ char js_valueOf_str[] = "valueOf";
|
||||
#define HASH_DOUBLE(dp) ((JSHashNumber)(((uint32*)(dp))[0] ^ ((uint32*)(dp))[1]))
|
||||
#define HASH_BOOLEAN(b) ((JSHashNumber)(b))
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(JSHashNumber)
|
||||
STATIC_DLL_CALLBACK(JSHashNumber)
|
||||
js_hash_atom_key(const void *key)
|
||||
{
|
||||
jsval v;
|
||||
@@ -104,7 +111,7 @@ js_hash_atom_key(const void *key)
|
||||
return (JSHashNumber)v;
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(intN)
|
||||
STATIC_DLL_CALLBACK(intN)
|
||||
js_compare_atom_keys(const void *k1, const void *k2)
|
||||
{
|
||||
jsval v1, v2;
|
||||
@@ -127,25 +134,25 @@ js_compare_atom_keys(const void *k1, const void *k2)
|
||||
return v1 == v2;
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(int)
|
||||
STATIC_DLL_CALLBACK(int)
|
||||
js_compare_stub(const void *v1, const void *v2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(void *)
|
||||
STATIC_DLL_CALLBACK(void *)
|
||||
js_alloc_atom_space(void *priv, size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(void)
|
||||
STATIC_DLL_CALLBACK(void)
|
||||
js_free_atom_space(void *priv, void *item)
|
||||
{
|
||||
free(item);
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(JSHashEntry *)
|
||||
STATIC_DLL_CALLBACK(JSHashEntry *)
|
||||
js_alloc_atom(void *priv, const void *key)
|
||||
{
|
||||
JSAtomState *state = priv;
|
||||
@@ -165,7 +172,7 @@ js_alloc_atom(void *priv, const void *key)
|
||||
return &atom->entry;
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(void)
|
||||
STATIC_DLL_CALLBACK(void)
|
||||
js_free_atom(void *priv, JSHashEntry *he, uintN flag)
|
||||
{
|
||||
if (flag != HT_FREE_ENTRY)
|
||||
@@ -238,7 +245,6 @@ js_InitAtomState(JSContext *cx, JSAtomState *state)
|
||||
FROB(toSourceAtom, js_toSource_str);
|
||||
FROB(toStringAtom, js_toString_str);
|
||||
FROB(valueOfAtom, js_valueOf_str);
|
||||
FROB(evalAtom, js_eval_str);
|
||||
|
||||
#undef FROB
|
||||
|
||||
@@ -262,7 +268,7 @@ typedef struct MarkArgs {
|
||||
JSGCThingMarker mark;
|
||||
} MarkArgs;
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(intN)
|
||||
STATIC_DLL_CALLBACK(intN)
|
||||
js_atom_marker(JSHashEntry *he, intN i, void *arg)
|
||||
{
|
||||
JSAtom *atom;
|
||||
@@ -291,7 +297,7 @@ js_MarkAtomState(JSAtomState *state, JSGCThingMarker mark)
|
||||
JS_HashTableEnumerateEntries(state->table, js_atom_marker, &args);
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(intN)
|
||||
STATIC_DLL_CALLBACK(intN)
|
||||
js_atom_sweeper(JSHashEntry *he, intN i, void *arg)
|
||||
{
|
||||
JSAtom *atom;
|
||||
@@ -313,7 +319,7 @@ js_SweepAtomState(JSAtomState *state)
|
||||
JS_HashTableEnumerateEntries(state->table, js_atom_sweeper, NULL);
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(intN)
|
||||
STATIC_DLL_CALLBACK(intN)
|
||||
js_atom_unpinner(JSHashEntry *he, intN i, void *arg)
|
||||
{
|
||||
JSAtom *atom;
|
||||
|
||||
@@ -23,7 +23,13 @@
|
||||
*/
|
||||
#include <stddef.h>
|
||||
#include "jstypes.h"
|
||||
#ifndef NSPR20
|
||||
#include "jshash.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "JShash.h"
|
||||
*/
|
||||
#include "jshash.h" /* Added by JSIFY */
|
||||
#endif
|
||||
#include "jsapi.h"
|
||||
#include "jsprvtd.h"
|
||||
#include "jspubtd.h"
|
||||
@@ -124,7 +130,6 @@ struct JSAtomState {
|
||||
JSAtom *toSourceAtom;
|
||||
JSAtom *toStringAtom;
|
||||
JSAtom *valueOfAtom;
|
||||
JSAtom *evalAtom;
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
JSThinLock lock;
|
||||
|
||||
@@ -37,12 +37,12 @@ typedef unsigned long jsbitmap_t;
|
||||
/*
|
||||
** Compute the log of the least power of 2 greater than or equal to n
|
||||
*/
|
||||
JS_EXTERN_API(JSIntn) JS_CeilingLog2(JSUint32 i);
|
||||
EXTERN(JSIntn) JS_CeilingLog2(JSUint32 i);
|
||||
|
||||
/*
|
||||
** Compute the log of the greatest power of 2 less than or equal to n
|
||||
*/
|
||||
JS_EXTERN_API(JSIntn) JS_FloorLog2(JSUint32 i);
|
||||
EXTERN(JSIntn) JS_FloorLog2(JSUint32 i);
|
||||
|
||||
/*
|
||||
** Macro version of JS_CeilingLog2: Compute the log of the least power of
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
#include "jsstddef.h"
|
||||
#include "jstypes.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsapi.h"
|
||||
#include "jsatom.h"
|
||||
|
||||
@@ -24,7 +24,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
#ifndef NSPR20
|
||||
#include "jsarena.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "plarena.h"
|
||||
*/
|
||||
#include "jsarena.h" /* Added by JSIFY */
|
||||
#endif
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsclist.h"
|
||||
#include "jsprf.h"
|
||||
@@ -77,9 +84,6 @@ js_NewContext(JSRuntime *rt, size_t stacksize)
|
||||
js_DestroyContext(cx);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
#if JS_HAS_EXCEPTIONS
|
||||
cx->throwing = JS_FALSE;
|
||||
#endif
|
||||
return cx;
|
||||
}
|
||||
@@ -200,8 +204,7 @@ js_ReportErrorVA(JSContext *cx, uintN flags, const char *format, va_list ap)
|
||||
JSBool
|
||||
js_ExpandErrorArguments(JSContext *cx, JSErrorCallback callback,
|
||||
void *userRef, const uintN errorNumber,
|
||||
char **messagep, JSErrorReport *reportp,
|
||||
JSBool charArgs, va_list ap)
|
||||
char **messagep, JSErrorReport *reportp, va_list ap)
|
||||
{
|
||||
const JSErrorFormatString *fmtData;
|
||||
int i;
|
||||
@@ -211,30 +214,18 @@ js_ExpandErrorArguments(JSContext *cx, JSErrorCallback callback,
|
||||
if (callback) {
|
||||
fmtData = (*callback)(userRef, "Mountain View", errorNumber);
|
||||
if (fmtData != NULL) {
|
||||
int totalArgsLength = 0;
|
||||
int argLengths[10]; /* only {0} thru {9} supported */
|
||||
argCount = fmtData->argCount;
|
||||
JS_ASSERT(argCount <= 10);
|
||||
if (argCount > 0) {
|
||||
/*
|
||||
* Gather the arguments into an array, and accumulate
|
||||
* their sizes.
|
||||
* Gather the arguments into a char * array, the
|
||||
* messageArgs field is supposed to be an array of
|
||||
* JSString's and we'll convert them later.
|
||||
*/
|
||||
reportp->messageArgs
|
||||
= JS_malloc(cx, sizeof(jschar *) * argCount);
|
||||
reportp->messageArgs = malloc(sizeof(char *) * argCount);
|
||||
if (!reportp->messageArgs)
|
||||
return JS_FALSE;
|
||||
for (i = 0; i < argCount; i++) {
|
||||
if (charArgs) {
|
||||
char *charArg = va_arg(ap, char *);
|
||||
reportp->messageArgs[i]
|
||||
= js_InflateString(cx, charArg, strlen(charArg));
|
||||
}
|
||||
else
|
||||
reportp->messageArgs[i] = va_arg(ap, jschar *);
|
||||
argLengths[i] = js_strlen(reportp->messageArgs[i]);
|
||||
totalArgsLength += argLengths[i];
|
||||
}
|
||||
for (i = 0; i < argCount; i++)
|
||||
reportp->messageArgs[i] = (JSString *) va_arg(ap, char *);
|
||||
}
|
||||
/*
|
||||
* Parse the error format, substituting the argument X
|
||||
@@ -242,22 +233,21 @@ js_ExpandErrorArguments(JSContext *cx, JSErrorCallback callback,
|
||||
*/
|
||||
if (argCount > 0) {
|
||||
if (fmtData->format) {
|
||||
const char *fmt;
|
||||
const jschar *arg;
|
||||
jschar *out;
|
||||
const char *fmt, *arg;
|
||||
char *out;
|
||||
int expandedArgs = 0;
|
||||
int expandedLength
|
||||
= strlen(fmtData->format)
|
||||
- (3 * argCount) /* exclude the {n} */
|
||||
+ totalArgsLength;
|
||||
/* Note - the above calculation assumes that each argument
|
||||
* is used once and only once in the expansion !!!
|
||||
*/
|
||||
reportp->ucmessage = out
|
||||
= JS_malloc(cx, (expandedLength + 1) * sizeof(jschar));
|
||||
- (3 * argCount); /* exclude the {n} */
|
||||
|
||||
for (i = 0; i < argCount; i++) {
|
||||
expandedLength
|
||||
+= strlen((char *)reportp->messageArgs[i]);
|
||||
}
|
||||
*messagep = out = malloc(expandedLength + 1);
|
||||
if (!out) {
|
||||
if (reportp->messageArgs) {
|
||||
JS_free(cx, (void *)reportp->messageArgs);
|
||||
free(reportp->messageArgs);
|
||||
reportp->messageArgs = NULL;
|
||||
}
|
||||
return JS_FALSE;
|
||||
@@ -268,32 +258,33 @@ js_ExpandErrorArguments(JSContext *cx, JSErrorCallback callback,
|
||||
if (isdigit(fmt[1])) {
|
||||
int d = JS7_UNDEC(fmt[1]);
|
||||
JS_ASSERT(expandedArgs < argCount);
|
||||
arg = reportp->messageArgs[d];
|
||||
js_strncpy(out, arg, argLengths[d]);
|
||||
out += argLengths[d];
|
||||
arg = (char *)reportp->messageArgs[d];
|
||||
strcpy(out, arg);
|
||||
out += strlen(arg);
|
||||
fmt += 3;
|
||||
expandedArgs++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* is this kosher?
|
||||
*/
|
||||
*out++ = (unsigned char)(*fmt++);
|
||||
*out++ = *fmt++;
|
||||
}
|
||||
JS_ASSERT(expandedArgs == argCount);
|
||||
*out = 0;
|
||||
*messagep = js_DeflateString(cx, reportp->ucmessage,
|
||||
out - reportp->ucmessage);
|
||||
*out = '\0';
|
||||
}
|
||||
} else { /* 0 arguments, the format string
|
||||
(if it exists) is the entire message */
|
||||
if (fmtData->format) {
|
||||
*messagep = JS_strdup(cx, fmtData->format);
|
||||
reportp->ucmessage
|
||||
= js_InflateString(cx, *messagep, strlen(*messagep));
|
||||
}
|
||||
/*
|
||||
* Now convert all the arguments to JSStrings.
|
||||
*/
|
||||
for (i = 0; i < argCount; i++) {
|
||||
reportp->messageArgs[i] =
|
||||
JS_NewStringCopyZ(cx, (char *)reportp->messageArgs[i]);
|
||||
}
|
||||
} else {
|
||||
*messagep = JS_strdup(cx, fmtData->format);
|
||||
}
|
||||
/*
|
||||
* And finally convert the message.
|
||||
*/
|
||||
reportp->ucmessage = JS_NewStringCopyZ(cx, *messagep);
|
||||
}
|
||||
}
|
||||
if (*messagep == NULL) {
|
||||
@@ -301,7 +292,7 @@ js_ExpandErrorArguments(JSContext *cx, JSErrorCallback callback,
|
||||
const char *defaultErrorMessage
|
||||
= "No error message available for error number %d";
|
||||
size_t nbytes = strlen(defaultErrorMessage) + 16;
|
||||
*messagep = (char *)JS_malloc(cx, nbytes);
|
||||
*messagep = (char *)malloc(nbytes);
|
||||
JS_snprintf(*messagep, nbytes, defaultErrorMessage, errorNumber);
|
||||
}
|
||||
return JS_TRUE;
|
||||
@@ -309,8 +300,7 @@ js_ExpandErrorArguments(JSContext *cx, JSErrorCallback callback,
|
||||
|
||||
void
|
||||
js_ReportErrorNumberVA(JSContext *cx, uintN flags, JSErrorCallback callback,
|
||||
void *userRef, const uintN errorNumber,
|
||||
JSBool charArgs, va_list ap)
|
||||
void *userRef, const uintN errorNumber, va_list ap)
|
||||
{
|
||||
JSStackFrame *fp;
|
||||
JSErrorReport report;
|
||||
@@ -336,7 +326,7 @@ js_ReportErrorNumberVA(JSContext *cx, uintN flags, JSErrorCallback callback,
|
||||
report.errorNumber = errorNumber;
|
||||
|
||||
if (!js_ExpandErrorArguments(cx, callback, userRef, errorNumber,
|
||||
&message, &report, charArgs, ap))
|
||||
&message, &report, ap))
|
||||
return;
|
||||
|
||||
#if JS_HAS_ERROR_EXCEPTIONS
|
||||
@@ -352,9 +342,9 @@ js_ReportErrorNumberVA(JSContext *cx, uintN flags, JSErrorCallback callback,
|
||||
js_ReportErrorAgain(cx, message, &report);
|
||||
|
||||
if (message)
|
||||
JS_free(cx, message);
|
||||
free(message);
|
||||
if (report.messageArgs)
|
||||
JS_free(cx, (void *)report.messageArgs);
|
||||
free(report.messageArgs);
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
|
||||
@@ -21,7 +21,13 @@
|
||||
/*
|
||||
* JS execution context.
|
||||
*/
|
||||
#ifndef NSPR20
|
||||
#include "jsarena.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "plarena.h"
|
||||
*/
|
||||
#include "jsarena.h" /* Added by JSIFY */
|
||||
#endif
|
||||
#include "jsclist.h"
|
||||
#include "jslong.h"
|
||||
#include "jsatom.h"
|
||||
@@ -88,8 +94,6 @@ struct JSRuntime {
|
||||
void *executeHookData;
|
||||
JSInterpreterHook callHook;
|
||||
void *callHookData;
|
||||
JSObjectHook objectHook;
|
||||
void *objectHookData;
|
||||
|
||||
/* More debugging state, see jsdbgapi.c. */
|
||||
JSCList trapList;
|
||||
@@ -201,14 +205,13 @@ extern void
|
||||
js_ReportErrorVA(JSContext *cx, uintN flags, const char *format, va_list ap);
|
||||
extern void
|
||||
js_ReportErrorNumberVA(JSContext *cx, uintN flags, JSErrorCallback callback,
|
||||
void *userRef, const uintN errorNumber,
|
||||
JSBool charArgs, va_list ap);
|
||||
void *userRef, const uintN errorNumber, va_list ap);
|
||||
|
||||
extern JSBool
|
||||
js_ExpandErrorArguments(JSContext *cx, JSErrorCallback callback,
|
||||
void *userRef, const uintN errorNumber,
|
||||
char **message, JSErrorReport *reportp,
|
||||
JSBool charArgs, va_list ap);
|
||||
va_list ap);
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
ifndef OBJDIR
|
||||
ifdef OBJDIR_NAME
|
||||
OBJDIR = $(OBJDIR_NAME)
|
||||
endif
|
||||
endif
|
||||
|
||||
NSPR_VERSION = 19980120
|
||||
NSPR_LOCAL = $(MOZ_DEPTH)/dist/$(OBJDIR)/nspr
|
||||
NSPR_DIST = $(MOZ_DEPTH)/dist/$(OBJDIR)
|
||||
NSPR_OBJDIR = $(OBJDIR)
|
||||
ifeq ($(OS_ARCH), SunOS)
|
||||
NSPR_OBJDIR := $(subst _sparc,,$(NSPR_OBJDIR))
|
||||
endif
|
||||
ifeq ($(OS_ARCH), Linux)
|
||||
NSPR_OBJDIR := $(subst _All,ELF2.0,$(NSPR_OBJDIR))
|
||||
endif
|
||||
ifeq ($(OS_ARCH), AIX)
|
||||
NSPR_OBJDIR := $(subst 4.1,4.2,$(NSPR_OBJDIR))
|
||||
endif
|
||||
ifeq ($(OS_ARCH), WINNT)
|
||||
NSPR_OBJDIR := $(subst WINNT,WIN95,$(NSPR_OBJDIR))
|
||||
ifeq ($(OBJDIR), WIN32_D.OBJ)
|
||||
NSPR_OBJDIR = WIN954.0_DBG.OBJ
|
||||
endif
|
||||
ifeq ($(OBJDIR), WIN32_O.OBJ)
|
||||
NSPR_OBJDIR = WIN954.0_OPT.OBJ
|
||||
endif
|
||||
endif
|
||||
NSPR_SHARED = /share/builds/components/nspr20/$(NSPR_VERSION)/$(NSPR_OBJDIR)
|
||||
ifeq ($(OS_ARCH), WINNT)
|
||||
NSPR_SHARED = nspr20/$(NSPR_VERSION)/$(NSPR_OBJDIR)
|
||||
endif
|
||||
NSPR_VERSIONFILE = $(NSPR_LOCAL)/Version
|
||||
NSPR_CURVERSION := $(shell cat $(NSPR_VERSIONFILE))
|
||||
|
||||
get_nspr:
|
||||
@echo "Grabbing NSPR component..."
|
||||
ifeq ($(NSPR_VERSION), $(NSPR_CURVERSION))
|
||||
@echo "No need, NSPR is up to date in this tree (ver=$(NSPR_VERSION))."
|
||||
else
|
||||
mkdir -p $(NSPR_LOCAL)
|
||||
mkdir -p $(NSPR_DIST)
|
||||
ifneq ($(OS_ARCH), WINNT)
|
||||
cp $(NSPR_SHARED)/*.jar $(NSPR_LOCAL)
|
||||
else
|
||||
sh $(MOZ_DEPTH)/../reltools/compftp.sh $(NSPR_SHARED) $(NSPR_LOCAL) *.jar
|
||||
endif
|
||||
unzip -o $(NSPR_LOCAL)/mdbinary.jar -d $(NSPR_DIST)
|
||||
mkdir -p $(NSPR_DIST)/include
|
||||
unzip -o $(NSPR_LOCAL)/mdheader.jar -d $(NSPR_DIST)/include
|
||||
rm -rf $(NSPR_DIST)/META-INF
|
||||
rm -rf $(NSPR_DIST)/include/META-INF
|
||||
echo $(NSPR_VERSION) > $(NSPR_VERSIONFILE)
|
||||
endif
|
||||
|
||||
SHIP_DIST = $(MOZ_DEPTH)/dist/$(OBJDIR)
|
||||
SHIP_DIR = $(SHIP_DIST)/SHIP
|
||||
|
||||
SHIP_LIBS = jsj.so libjs.so libnspr21.so
|
||||
ifeq ($(OS_ARCH), WINNT)
|
||||
SHIP_LIBS = jsj.dll js32.dll libnspr21.dll
|
||||
endif
|
||||
ifeq ($(OS_ARCH), HP-UX)
|
||||
SHIP_LIBS = jsj.so libjs.so libnspr21.sl
|
||||
endif
|
||||
SHIP_LIBS := $(addprefix $(SHIP_DIST)/lib/, $(SHIP_LIBS))
|
||||
|
||||
SHIP_INCS = js*.h netscape*.h
|
||||
SHIP_INCS := $(addprefix $(SHIP_DIST)/include/, $(SHIP_INCS))
|
||||
|
||||
SHIP_BINS = js jsj
|
||||
ifeq ($(OS_ARCH), WINNT)
|
||||
SHIP_BINS = js.exe jsj.exe
|
||||
endif
|
||||
SHIP_BINS := $(addprefix $(SHIP_DIST)/bin/, $(SHIP_BINS))
|
||||
|
||||
ifdef BUILD_OPT
|
||||
JSREFJAR = jsref_opt.jar
|
||||
else
|
||||
JSREFJAR = jsref_dbg.jar
|
||||
endif
|
||||
|
||||
ship:
|
||||
mkdir -p $(SHIP_DIR)/lib
|
||||
mkdir -p $(SHIP_DIR)/include
|
||||
mkdir -p $(SHIP_DIR)/bin
|
||||
cp $(SHIP_LIBS) $(SHIP_DIR)/lib
|
||||
cp $(SHIP_INCS) $(SHIP_DIR)/include
|
||||
cp $(SHIP_BINS) $(SHIP_DIR)/bin
|
||||
cd $(SHIP_DIR); \
|
||||
zip -r $(JSREFJAR) bin lib include
|
||||
ifdef BUILD_SHIP
|
||||
cp $(SHIP_DIR)/$(JSREFJAR) $(BUILD_SHIP)
|
||||
endif
|
||||
@@ -21,13 +21,13 @@
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef sgi
|
||||
#if defined(sgi)
|
||||
#ifndef IRIX
|
||||
# error "IRIX is not defined"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __sun
|
||||
#if defined(__sun)
|
||||
#if defined(__svr4) || defined(__svr4__)
|
||||
#ifndef SOLARIS
|
||||
# error "SOLARIS is not defined"
|
||||
@@ -39,31 +39,37 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __hpux
|
||||
#if defined(__hpux)
|
||||
#ifndef HPUX
|
||||
# error "HPUX is not defined"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __osf__
|
||||
#if defined(__osf__)
|
||||
#ifndef OSF1
|
||||
# error "OSF1 is not defined"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _IBMR2
|
||||
#if defined(_IBMR2)
|
||||
#ifndef AIX
|
||||
# error "AIX is not defined"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef bsdi
|
||||
#if defined(linux)
|
||||
#ifndef LINUX
|
||||
# error "LINUX is not defined"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(bsdi)
|
||||
#ifndef BSDI
|
||||
# error "BSDI is not defined"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef M_UNIX
|
||||
#if defined(M_UNIX)
|
||||
#ifndef SCO
|
||||
# error "SCO is not defined"
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "jsosdep.h"
|
||||
|
||||
#ifdef XP_MAC
|
||||
#include "jsmacos.h"
|
||||
#undef IS_LITTLE_ENDIAN
|
||||
#define IS_BIG_ENDIAN 1
|
||||
|
||||
@@ -345,7 +346,7 @@
|
||||
#define PR_WORDS_PER_DWORD_LOG2 1L
|
||||
|
||||
|
||||
#elif defined(linux)
|
||||
#elif defined(LINUX)
|
||||
|
||||
#ifdef __powerpc__
|
||||
#undef IS_LITTLE_ENDIAN
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "jstypes.h"
|
||||
#include "jsprf.h"
|
||||
#include "prmjtime.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsapi.h"
|
||||
#include "jsconfig.h"
|
||||
@@ -1557,7 +1558,7 @@ date_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
||||
if (!date)
|
||||
return JS_FALSE;
|
||||
|
||||
JS_cnvtf(buf, sizeof buf, 20, *date);
|
||||
PR_cnvtf(buf, sizeof buf, 20, *date);
|
||||
bytes = JS_smprintf("(new %s(%s))", date_class.name, buf);
|
||||
if (!bytes) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "jsstddef.h"
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsclist.h"
|
||||
#include "jsapi.h"
|
||||
@@ -269,7 +270,7 @@ js_FindWatchPoint(JSRuntime *rt, JSObject *obj, jsval userid)
|
||||
return wp->sprop;
|
||||
}
|
||||
|
||||
JSBool JS_DLL_CALLBACK
|
||||
JSBool DLL_CALLBACK
|
||||
js_watch_set(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
JSRuntime *rt;
|
||||
@@ -847,7 +848,7 @@ JS_SetExecuteHook(JSRuntime *rt, JSInterpreterHook hook, void *closure)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_SetCallHook(JSRuntime *rt, JSInterpreterHook hook, void *closure)
|
||||
{
|
||||
rt->callHook = hook;
|
||||
@@ -855,10 +856,4 @@ JS_SetCallHook(JSRuntime *rt, JSInterpreterHook hook, void *closure)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_SetObjectHook(JSRuntime *rt, JSObjectHook hook, void *closure)
|
||||
{
|
||||
rt->objectHook = hook;
|
||||
rt->objectHookData = closure;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ JS_ClearAllWatchPoints(JSContext *cx);
|
||||
extern JSScopeProperty *
|
||||
js_FindWatchPoint(JSRuntime *rt, JSObject *obj, jsval userid);
|
||||
|
||||
extern JSBool JS_DLL_CALLBACK
|
||||
extern JSBool DLL_CALLBACK
|
||||
js_watch_set(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
|
||||
#endif
|
||||
|
||||
@@ -240,9 +240,6 @@ JS_SetExecuteHook(JSRuntime *rt, JSInterpreterHook hook, void *closure);
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_SetCallHook(JSRuntime *rt, JSInterpreterHook hook, void *closure);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_SetObjectHook(JSRuntime *rt, JSObjectHook hook, void *closure);
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
||||
#endif /* jsdbgapi_h___ */
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "jstypes.h"
|
||||
#include "jsdtoa.h"
|
||||
#include "jsprf.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
@@ -99,7 +100,7 @@
|
||||
* #define VAX for VAX-style floating-point arithmetic.
|
||||
* #define Unsigned_Shifts if >> does treats its left operand as unsigned.
|
||||
* #define No_leftright to omit left-right logic in fast floating-point
|
||||
* computation of JS_dtoa.
|
||||
* computation of PR_dtoa.
|
||||
* #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3.
|
||||
* #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines
|
||||
* that use extended-precision instructions to compute rounded
|
||||
@@ -1198,8 +1199,8 @@ static void InitDtoa(void)
|
||||
|
||||
/* nspr2 watcom bug ifdef omitted */
|
||||
|
||||
JS_FRIEND_API(double)
|
||||
JS_strtod(CONST char *s00, char **se)
|
||||
PUBLIC_API(double)
|
||||
PR_strtod(CONST char *s00, char **se)
|
||||
{
|
||||
int32 bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign,
|
||||
e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
|
||||
@@ -1873,7 +1874,7 @@ quorem(Bigint *b, Bigint *S)
|
||||
*/
|
||||
|
||||
static JSBool
|
||||
JS_dtoa(double d, int mode, int ndigits,
|
||||
PR_dtoa(double d, int mode, int ndigits,
|
||||
int *decpt, int *sign, char **rve, char *buf, size_t bufsize)
|
||||
{
|
||||
/* Arguments ndigits, decpt, sign are similar to those
|
||||
@@ -2519,8 +2520,8 @@ ret1:
|
||||
** Also, the ECMA spec says that there should always be a
|
||||
** '+' or '-' after the 'e' in scientific notation
|
||||
*/
|
||||
JS_FRIEND_API(void)
|
||||
JS_cnvtf(char *buf,int bufsz, int prcsn,double fval)
|
||||
PUBLIC_API(void)
|
||||
PR_cnvtf(char *buf,int bufsz, int prcsn,double fval)
|
||||
{
|
||||
intN decpt,sign,numdigits;
|
||||
char *num, *nump;
|
||||
@@ -2534,7 +2535,7 @@ JS_cnvtf(char *buf,int bufsz, int prcsn,double fval)
|
||||
return;
|
||||
}
|
||||
/* XXX Why use mode 1? */
|
||||
if (JS_dtoa(fval,1,prcsn,&decpt,&sign,&endnum,num,bufsz)
|
||||
if (PR_dtoa(fval,1,prcsn,&decpt,&sign,&endnum,num,bufsz)
|
||||
== JS_FALSE) {
|
||||
buf[0] = '\0';
|
||||
goto done;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
JS_BEGIN_EXTERN_C
|
||||
|
||||
/*
|
||||
* JS_strtod() returns as a double-precision floating-point number
|
||||
* PR_strtod() returns as a double-precision floating-point number
|
||||
* the value represented by the character string pointed to by
|
||||
* s00. The string is scanned up to the first unrecognized
|
||||
* character.
|
||||
@@ -37,17 +37,17 @@ JS_BEGIN_EXTERN_C
|
||||
* to by se. If no number can be formed, se is set to s00r, and
|
||||
* zero is returned.
|
||||
*/
|
||||
JS_FRIEND_API(double)
|
||||
JS_strtod(const char *s00, char **se);
|
||||
extern PUBLIC_API(double)
|
||||
PR_strtod(const char *s00, char **se);
|
||||
|
||||
/*
|
||||
* JS_cnvtf()
|
||||
* PR_cnvtf()
|
||||
* conversion routines for floating point
|
||||
* prcsn - number of digits of precision to generate floating
|
||||
* point value.
|
||||
*/
|
||||
JS_FRIEND_API(void)
|
||||
JS_cnvtf(char *buf, intN bufsz, intN prcsn, double dval);
|
||||
extern PUBLIC_API(void)
|
||||
PR_cnvtf(char *buf, intN bufsz, intN prcsn, double dval);
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
||||
|
||||
@@ -23,7 +23,14 @@
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
#ifndef NSPR20
|
||||
#include "jsarena.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "plarena.h"
|
||||
*/
|
||||
#include "jsarena.h" /* Added by JSIFY */
|
||||
#endif
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsprf.h"
|
||||
#include "jsapi.h"
|
||||
@@ -64,7 +71,7 @@ js_InitCodeGenerator(JSContext *cx, JSCodeGenerator *cg,
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_FinishCodeGenerator(JSContext *cx, JSCodeGenerator *cg)
|
||||
js_ResetCodeGenerator(JSContext *cx, JSCodeGenerator *cg)
|
||||
{
|
||||
JS_ARENA_RELEASE(&cx->codePool, cg->codeMark);
|
||||
JS_ARENA_RELEASE(&cx->tempPool, cg->tempMark);
|
||||
@@ -499,44 +506,11 @@ FixupCatchJumps(JSContext *cx, JSCodeGenerator *cg, ptrdiff_t tryStart,
|
||||
|
||||
#endif /* JS_HAS_EXCEPTIONS */
|
||||
|
||||
|
||||
/* a macro for inlining at the top of js_EmitTree (from whence it came) */
|
||||
#define UPDATE_LINENO_NOTES(cx, cg, pn) \
|
||||
JS_BEGIN_MACRO \
|
||||
uintN lineno, delta; \
|
||||
lineno = pn->pn_pos.begin.lineno; \
|
||||
delta = lineno - cg->currentLine; \
|
||||
cg->currentLine = lineno; \
|
||||
if (delta) { \
|
||||
/* \
|
||||
* Encode any change in the current source line number by using \
|
||||
* either several SRC_NEWLINE notes or one SRC_SETLINE note, \
|
||||
* whichever consumes less space. \
|
||||
*/ \
|
||||
if (delta >= (uintN)(2 + ((lineno > SN_3BYTE_OFFSET_MASK) << 1))) { \
|
||||
if (js_NewSrcNote2(cx, cg, SRC_SETLINE, (ptrdiff_t)lineno) < 0) \
|
||||
return JS_FALSE; \
|
||||
} else { \
|
||||
do { \
|
||||
if (js_NewSrcNote(cx, cg, SRC_NEWLINE) < 0) \
|
||||
return JS_FALSE; \
|
||||
} while (--delta != 0); \
|
||||
} \
|
||||
} \
|
||||
JS_END_MACRO
|
||||
|
||||
/* a function so that we can make the (few) less frequent calls */
|
||||
static JSBool
|
||||
UpdateLinenoNotes(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
{
|
||||
UPDATE_LINENO_NOTES(cx, cg, pn);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool
|
||||
js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
{
|
||||
JSBool ok;
|
||||
uintN lineno, delta;
|
||||
JSCodeGenerator cg2;
|
||||
JSStmtInfo *stmt, stmtInfo;
|
||||
ptrdiff_t top, off, tmp, beq, jmp;
|
||||
@@ -551,7 +525,25 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
pn->pn_offset = top = CG_OFFSET(cg);
|
||||
|
||||
/* Emit notes to tell the current bytecode's source line number. */
|
||||
UPDATE_LINENO_NOTES(cx, cg, pn);
|
||||
lineno = pn->pn_pos.begin.lineno;
|
||||
delta = lineno - cg->currentLine;
|
||||
cg->currentLine = lineno;
|
||||
if (delta) {
|
||||
/*
|
||||
* Encode any change in the current source line number by using either
|
||||
* several SRC_NEWLINE notes or one SRC_SETLINE note, whichever
|
||||
* consumes less space.
|
||||
*/
|
||||
if (delta >= (uintN)(2 + ((lineno > SN_3BYTE_OFFSET_MASK) << 1))) {
|
||||
if (js_NewSrcNote2(cx, cg, SRC_SETLINE, (ptrdiff_t)lineno) < 0)
|
||||
return JS_FALSE;
|
||||
} else {
|
||||
do {
|
||||
if (js_NewSrcNote(cx, cg, SRC_NEWLINE) < 0)
|
||||
return JS_FALSE;
|
||||
} while (--delta != 0);
|
||||
}
|
||||
}
|
||||
|
||||
switch (pn->pn_type) {
|
||||
case TOK_FUNCTION:
|
||||
@@ -571,7 +563,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
fun = pn->pn_fun;
|
||||
if (!js_EmitFunctionBody(cx, &cg2, pn2, fun))
|
||||
return JS_FALSE;
|
||||
js_FinishCodeGenerator(cx, &cg2);
|
||||
js_ResetCodeGenerator(cx, &cg2);
|
||||
|
||||
/* Make the function object a literal in the outer script's pool. */
|
||||
atom = js_AtomizeObject(cx, fun->object, 0);
|
||||
@@ -755,10 +747,14 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
}
|
||||
} else {
|
||||
/* Pre-ECMAv2 switch evals case exprs at compile time. */
|
||||
if (!js_InitCodeGenerator(cx, &cg2, cg->filename,
|
||||
pn3->pn_pos.begin.lineno,
|
||||
cg->principals)) {
|
||||
return JS_FALSE;
|
||||
if (!cg2.base) {
|
||||
if (!js_InitCodeGenerator(cx, &cg2, cg->filename,
|
||||
pn3->pn_pos.begin.lineno,
|
||||
cg->principals)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
} else {
|
||||
js_ResetCodeGenerator(cx, &cg2);
|
||||
}
|
||||
cg2.currentLine = pn4->pn_pos.begin.lineno;
|
||||
if (!js_EmitTree(cx, &cg2, pn4))
|
||||
@@ -808,7 +804,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
JS_ASSERT(!cg2.base);
|
||||
} else {
|
||||
if (cg2.base)
|
||||
js_FinishCodeGenerator(cx, &cg2);
|
||||
js_ResetCodeGenerator(cx, &cg2);
|
||||
if (switchop == JSOP_TABLESWITCH) {
|
||||
tablen = (uint32)(high - low + 1);
|
||||
if (tablen >= JS_BIT(16) || tablen > 2 * ncases)
|
||||
@@ -1348,9 +1344,6 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
iter = iter->pn_kid2;
|
||||
disc = iter->pn_kid1;
|
||||
|
||||
if (!UpdateLinenoNotes(cx, cg, iter))
|
||||
return JS_FALSE;
|
||||
|
||||
if (catchjmp != -1) {
|
||||
/* fix up and clean up previous catch block */
|
||||
CHECK_AND_SET_JUMP_OFFSET_AT(cx, cg, catchjmp);
|
||||
@@ -1360,7 +1353,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
js_Emit1(cx, cg, JSOP_LEAVEWITH) < 0)
|
||||
return JS_FALSE;
|
||||
} else {
|
||||
/* set stack to original depth (see SETSP comment above) */
|
||||
/* set stack to orig depth (see SETSP comment above) */
|
||||
EMIT_ATOM_INDEX_OP(JSOP_SETSP, (jsatomid)depth);
|
||||
}
|
||||
|
||||
@@ -1445,6 +1438,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
*/
|
||||
if (pn->pn_kid3 ||
|
||||
(catchjmp != -1 && iter->pn_kid1->pn_expr)) {
|
||||
|
||||
/*
|
||||
* Emit another stack fix, because the catch could itself
|
||||
* throw an exception in an unbalanced state, and the finally
|
||||
@@ -1452,7 +1446,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
*/
|
||||
EMIT_ATOM_INDEX_OP(JSOP_SETSP, (jsatomid)depth);
|
||||
|
||||
if (catchjmp != -1 && iter->pn_kid1->pn_expr) {
|
||||
if (catchjmp != -1) {
|
||||
CHECK_AND_SET_JUMP_OFFSET_AT(cx, cg, catchjmp);
|
||||
}
|
||||
/* last discriminant jumps to rethrow if none match */
|
||||
@@ -1484,8 +1478,6 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
if (!FixupFinallyJumps(cx, cg, start, finallyIndex))
|
||||
return JS_FALSE;
|
||||
js_PopStatementCG(cx, cg);
|
||||
if (!UpdateLinenoNotes(cx, cg, pn->pn_kid3))
|
||||
return JS_FALSE;
|
||||
if (js_NewSrcNote2(cx, cg, SRC_TRYFIN, 1) < 0 ||
|
||||
js_Emit1(cx, cg, JSOP_NOP) < 0 ||
|
||||
!js_EmitTree(cx, cg, pn->pn_kid3) ||
|
||||
@@ -1943,15 +1935,6 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
op = JSOP_CALL;
|
||||
emit_call:
|
||||
pn2 = pn->pn_head;
|
||||
if ((cx->version == JSVERSION_DEFAULT || cx->version >= JSVERSION_1_4)
|
||||
&& (pn2->pn_op == JSOP_NAME)
|
||||
/*
|
||||
* below, is it sufficient to compare the atom values ?
|
||||
*/
|
||||
&& (ATOM_KEY(pn2->pn_atom)
|
||||
== ATOM_KEY(cx->runtime->atomState.evalAtom)))
|
||||
op = JSOP_CALLSPECIAL;
|
||||
|
||||
if (!js_EmitTree(cx, cg, pn2))
|
||||
return JS_FALSE;
|
||||
|
||||
|
||||
@@ -115,12 +115,9 @@ js_InitCodeGenerator(JSContext *cx, JSCodeGenerator *cg,
|
||||
|
||||
/*
|
||||
* Release cx->codePool and cx->tempPool to marks set by js_InitCodeGenerator.
|
||||
* Note that cgs are magic: they own tempPool and codePool "tops-of-stack"
|
||||
* above their codeMark and tempMark points. This means you cannot alloc
|
||||
* from tempPool and save the pointer beyond the next JS_FinishCodeGenerator.
|
||||
*/
|
||||
extern JS_FRIEND_API(void)
|
||||
js_FinishCodeGenerator(JSContext *cx, JSCodeGenerator *cg);
|
||||
js_ResetCodeGenerator(JSContext *cx, JSCodeGenerator *cg);
|
||||
|
||||
/*
|
||||
* Emit one bytecode.
|
||||
@@ -298,7 +295,7 @@ typedef enum JSSrcNoteType {
|
||||
|
||||
extern JS_FRIEND_DATA(const char *) js_SrcNoteName[];
|
||||
extern JS_FRIEND_DATA(uint8) js_SrcNoteArity[];
|
||||
extern JS_FRIEND_API(uintN) js_SrcNoteLength(jssrcnote *sn);
|
||||
extern JS_FRIEND_DATA(uintN) js_SrcNoteLength(jssrcnote *sn);
|
||||
|
||||
#define SN_LENGTH(sn) ((js_SrcNoteArity[SN_TYPE(sn)] == 0) ? 1 \
|
||||
: js_SrcNoteLength(sn))
|
||||
@@ -345,7 +342,7 @@ js_FinishTakingSrcNotes(JSContext *cx, JSCodeGenerator *cg);
|
||||
/*
|
||||
* Allocate cg->treeContext.tryCount notes (plus one for the end sentinel)
|
||||
* from cx->tempPool and set up cg->tryBase/tryNext for exactly tryCount
|
||||
* js_NewTryNote calls. The storage is freed by js_FinishCodeGenerator.
|
||||
* js_NewTryNote calls. The storage is freed by js_ResetCodeGenerator.
|
||||
*/
|
||||
extern JSBool
|
||||
js_AllocTryNotes(JSContext *cx, JSCodeGenerator *cg);
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "jsstddef.h"
|
||||
#include "jstypes.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsprf.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "jsstddef.h"
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsapi.h"
|
||||
#include "jsarray.h"
|
||||
@@ -1189,26 +1190,11 @@ fun_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
uint32 indent;
|
||||
JSString *str;
|
||||
|
||||
fval = argv[-1];
|
||||
if (!JSVAL_IS_FUNCTION(cx, fval)) {
|
||||
/*
|
||||
if we don't have a function to start off with, try converting the
|
||||
object to a function. If that doesn't work, complain.
|
||||
*/
|
||||
if (JSVAL_IS_OBJECT(fval)) {
|
||||
obj = JSVAL_TO_OBJECT(fval);
|
||||
if (!OBJ_GET_CLASS(cx, obj)->convert(cx, obj, JSTYPE_FUNCTION, &fval))
|
||||
return JS_FALSE;
|
||||
}
|
||||
if (!JSVAL_IS_FUNCTION(cx, fval)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_INCOMPATIBLE_PROTO,
|
||||
"Function", "toString",
|
||||
JS_GetStringBytes(JS_ValueToString(cx, fval)));
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!OBJ_DEFAULT_VALUE(cx, obj, JSTYPE_FUNCTION, &argv[-1]))
|
||||
return JS_FALSE;
|
||||
fval = argv[-1];
|
||||
if (!JSVAL_IS_FUNCTION(cx, fval))
|
||||
return js_obj_toString(cx, obj, argc, argv, rval);
|
||||
obj = JSVAL_TO_OBJECT(fval);
|
||||
fun = JS_GetPrivate(cx, obj);
|
||||
if (!fun)
|
||||
@@ -1237,14 +1223,6 @@ fun_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
return JS_FALSE;
|
||||
fval = argv[-1];
|
||||
|
||||
if (!JSVAL_IS_FUNCTION(cx, fval)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_INCOMPATIBLE_PROTO,
|
||||
"Function", "call",
|
||||
JS_GetStringBytes(JS_ValueToString(cx, fval)));
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (argc == 0) {
|
||||
/* Call fun with its parent as the 'this' parameter if no args. */
|
||||
obj = OBJ_GET_PARENT(cx, obj);
|
||||
@@ -1304,13 +1282,6 @@ fun_apply(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
return JS_FALSE;
|
||||
fval = argv[-1];
|
||||
|
||||
if (!JSVAL_IS_FUNCTION(cx, fval)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_INCOMPATIBLE_PROTO,
|
||||
"Function", "apply",
|
||||
JS_GetStringBytes(JS_ValueToString(cx, fval)));
|
||||
return JS_FALSE;
|
||||
}
|
||||
/* Convert the first arg to 'this' and skip over it. */
|
||||
if (!js_ValueToObject(cx, argv[0], &obj))
|
||||
return JS_FALSE;
|
||||
|
||||
@@ -30,9 +30,22 @@
|
||||
#include <stdlib.h> /* for free, called by JS_ARENA_DESTROY */
|
||||
#include <string.h> /* for memset, called by jsarena.h macros if DEBUG */
|
||||
#include "jstypes.h"
|
||||
#ifndef NSPR20
|
||||
#include "jsarena.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "plarena.h"
|
||||
*/
|
||||
#include "jsarena.h" /* Added by JSIFY */
|
||||
#endif
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#ifndef NSPR20
|
||||
#include "jshash.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "JShash.h"
|
||||
*/
|
||||
#include "jshash.h" /* Added by JSIFY */
|
||||
#endif
|
||||
#include "jsapi.h"
|
||||
#include "jsatom.h"
|
||||
#include "jscntxt.h"
|
||||
@@ -578,7 +591,7 @@ gc_hash_root(const void *key)
|
||||
return num >> 2;
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(intN)
|
||||
STATIC_DLL_CALLBACK(intN)
|
||||
gc_root_marker(JSHashEntry *he, intN i, void *arg)
|
||||
{
|
||||
void **rp = (void **)he->key;
|
||||
@@ -587,17 +600,11 @@ gc_root_marker(JSHashEntry *he, intN i, void *arg)
|
||||
#ifdef DEBUG
|
||||
JSArena *a;
|
||||
JSRuntime *rt = (JSRuntime *)arg;
|
||||
JSBool root_points_to_gcArenaPool = JS_FALSE;
|
||||
|
||||
if (rp && *rp) {
|
||||
for (a = rt->gcArenaPool.first.next; a; a = a->next) {
|
||||
if (*rp >= (void *)a->base && *rp <= (void *)a->avail) {
|
||||
root_points_to_gcArenaPool = JS_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
JS_ASSERT(root_points_to_gcArenaPool);
|
||||
}
|
||||
for (a = rt->gcArenaPool.first.next; a; a = a->next) {
|
||||
JS_ASSERT(!rp ||
|
||||
(*rp >= (void *)a->base && *rp <= (void *)a->avail));
|
||||
}
|
||||
#endif
|
||||
GC_MARK(arg, *rp, he->value ? he->value : "root", NULL);
|
||||
}
|
||||
|
||||
@@ -23,11 +23,18 @@
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
#include "jsbit.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#ifndef NSPR20
|
||||
#include "jshash.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "JShash.h"
|
||||
*/
|
||||
#include "jshash.h" /* Added by JSIFY */
|
||||
#endif
|
||||
|
||||
/* Compute the number of buckets in ht */
|
||||
#define NBUCKETS(ht) JS_BIT(JS_HASH_BITS - (ht)->shift)
|
||||
#define NBUCKETS(ht) JS_BIT(PR_HASH_BITS - (ht)->shift)
|
||||
|
||||
/* The smallest table has 16 buckets */
|
||||
#define MINBUCKETSLOG2 4
|
||||
@@ -72,7 +79,7 @@ static JSHashAllocOps defaultHashAllocOps = {
|
||||
DefaultAllocEntry, DefaultFreeEntry
|
||||
};
|
||||
|
||||
JS_EXPORT_API(JSHashTable *)
|
||||
IMPLEMENT(JSHashTable *)
|
||||
JS_NewHashTable(uint32 n, JSHashFunction keyHash,
|
||||
JSHashComparator keyCompare, JSHashComparator valueCompare,
|
||||
JSHashAllocOps *allocOps, void *allocPriv)
|
||||
@@ -94,7 +101,7 @@ JS_NewHashTable(uint32 n, JSHashFunction keyHash,
|
||||
if (!ht)
|
||||
return NULL;
|
||||
memset(ht, 0, sizeof *ht);
|
||||
ht->shift = JS_HASH_BITS - n;
|
||||
ht->shift = PR_HASH_BITS - n;
|
||||
n = JS_BIT(n);
|
||||
#if defined(XP_PC) && defined _MSC_VER && _MSC_VER <= 800
|
||||
if (n > 16000) {
|
||||
@@ -118,7 +125,7 @@ JS_NewHashTable(uint32 n, JSHashFunction keyHash,
|
||||
return ht;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(void)
|
||||
IMPLEMENT(void)
|
||||
JS_HashTableDestroy(JSHashTable *ht)
|
||||
{
|
||||
uint32 i, n;
|
||||
@@ -146,7 +153,7 @@ JS_HashTableDestroy(JSHashTable *ht)
|
||||
/*
|
||||
** Multiplicative hash, from Knuth 6.4.
|
||||
*/
|
||||
JS_EXPORT_API(JSHashEntry **)
|
||||
IMPLEMENT(JSHashEntry **)
|
||||
JS_HashTableRawLookup(JSHashTable *ht, JSHashNumber keyHash, const void *key)
|
||||
{
|
||||
JSHashEntry *he, **hep, **hep0;
|
||||
@@ -155,7 +162,7 @@ JS_HashTableRawLookup(JSHashTable *ht, JSHashNumber keyHash, const void *key)
|
||||
#ifdef HASHMETER
|
||||
ht->nlookups++;
|
||||
#endif
|
||||
h = keyHash * JS_GOLDEN_RATIO;
|
||||
h = keyHash * PR_GOLDEN_RATIO;
|
||||
h >>= ht->shift;
|
||||
hep = hep0 = &ht->buckets[h];
|
||||
while ((he = *hep) != NULL) {
|
||||
@@ -176,7 +183,7 @@ JS_HashTableRawLookup(JSHashTable *ht, JSHashNumber keyHash, const void *key)
|
||||
return hep;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(JSHashEntry *)
|
||||
IMPLEMENT(JSHashEntry *)
|
||||
JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **hep,
|
||||
JSHashNumber keyHash, const void *key, void *value)
|
||||
{
|
||||
@@ -233,7 +240,7 @@ JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **hep,
|
||||
return he;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(JSHashEntry *)
|
||||
IMPLEMENT(JSHashEntry *)
|
||||
JS_HashTableAdd(JSHashTable *ht, const void *key, void *value)
|
||||
{
|
||||
JSHashNumber keyHash;
|
||||
@@ -255,7 +262,7 @@ JS_HashTableAdd(JSHashTable *ht, const void *key, void *value)
|
||||
return JS_HashTableRawAdd(ht, hep, keyHash, key, value);
|
||||
}
|
||||
|
||||
JS_EXPORT_API(void)
|
||||
IMPLEMENT(void)
|
||||
JS_HashTableRawRemove(JSHashTable *ht, JSHashEntry **hep, JSHashEntry *he)
|
||||
{
|
||||
uint32 i, n;
|
||||
@@ -297,7 +304,7 @@ JS_HashTableRawRemove(JSHashTable *ht, JSHashEntry **hep, JSHashEntry *he)
|
||||
}
|
||||
}
|
||||
|
||||
JS_EXPORT_API(JSBool)
|
||||
IMPLEMENT(JSBool)
|
||||
JS_HashTableRemove(JSHashTable *ht, const void *key)
|
||||
{
|
||||
JSHashNumber keyHash;
|
||||
@@ -313,7 +320,7 @@ JS_HashTableRemove(JSHashTable *ht, const void *key)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(void *)
|
||||
IMPLEMENT(void *)
|
||||
JS_HashTableLookup(JSHashTable *ht, const void *key)
|
||||
{
|
||||
JSHashNumber keyHash;
|
||||
@@ -332,7 +339,7 @@ JS_HashTableLookup(JSHashTable *ht, const void *key)
|
||||
** entry found. Stop if "f" says to (return value & JS_ENUMERATE_STOP).
|
||||
** Return a count of the number of elements scanned.
|
||||
*/
|
||||
JS_EXPORT_API(int)
|
||||
IMPLEMENT(int)
|
||||
JS_HashTableEnumerateEntries(JSHashTable *ht, JSHashEnumerator f, void *arg)
|
||||
{
|
||||
JSHashEntry *he, **hep;
|
||||
@@ -373,7 +380,7 @@ out:
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
JS_EXPORT_API(void)
|
||||
IMPLEMENT(void)
|
||||
JS_HashTableDumpMeter(JSHashTable *ht, JSHashEnumerator dump, FILE *fp)
|
||||
{
|
||||
double mean, variance;
|
||||
@@ -419,7 +426,7 @@ JS_HashTableDumpMeter(JSHashTable *ht, JSHashEnumerator dump, FILE *fp)
|
||||
}
|
||||
#endif /* HASHMETER */
|
||||
|
||||
JS_EXPORT_API(int)
|
||||
IMPLEMENT(int)
|
||||
JS_HashTableDump(JSHashTable *ht, JSHashEnumerator dump, FILE *fp)
|
||||
{
|
||||
int count;
|
||||
@@ -431,7 +438,7 @@ JS_HashTableDump(JSHashTable *ht, JSHashEnumerator dump, FILE *fp)
|
||||
return count;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(JSHashNumber)
|
||||
IMPLEMENT(JSHashNumber)
|
||||
JS_HashString(const void *key)
|
||||
{
|
||||
JSHashNumber h;
|
||||
@@ -443,7 +450,7 @@ JS_HashString(const void *key)
|
||||
return h;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(int)
|
||||
IMPLEMENT(int)
|
||||
JS_CompareValues(const void *v1, const void *v2)
|
||||
{
|
||||
return v1 == v2;
|
||||
|
||||
@@ -32,8 +32,8 @@ typedef uint32 JSHashNumber;
|
||||
typedef struct JSHashEntry JSHashEntry;
|
||||
typedef struct JSHashTable JSHashTable;
|
||||
|
||||
#define JS_HASH_BITS 32
|
||||
#define JS_GOLDEN_RATIO 0x9E3779B9U
|
||||
#define PR_HASH_BITS 32
|
||||
#define PR_GOLDEN_RATIO 0x9E3779B9U
|
||||
|
||||
typedef JSHashNumber (*JSHashFunction)(const void *key);
|
||||
typedef intN (*JSHashComparator)(const void *v1, const void *v2);
|
||||
@@ -83,47 +83,47 @@ struct JSHashTable {
|
||||
* Create a new hash table.
|
||||
* If allocOps is null, use default allocator ops built on top of malloc().
|
||||
*/
|
||||
JS_EXTERN_API(JSHashTable *)
|
||||
EXTERN(JSHashTable *)
|
||||
JS_NewHashTable(uint32 n, JSHashFunction keyHash,
|
||||
JSHashComparator keyCompare, JSHashComparator valueCompare,
|
||||
JSHashAllocOps *allocOps, void *allocPriv);
|
||||
|
||||
JS_EXTERN_API(void)
|
||||
EXTERN(void)
|
||||
JS_HashTableDestroy(JSHashTable *ht);
|
||||
|
||||
/* Low level access methods */
|
||||
JS_EXTERN_API(JSHashEntry **)
|
||||
EXTERN(JSHashEntry **)
|
||||
JS_HashTableRawLookup(JSHashTable *ht, JSHashNumber keyHash, const void *key);
|
||||
|
||||
JS_EXTERN_API(JSHashEntry *)
|
||||
EXTERN(JSHashEntry *)
|
||||
JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **hep, JSHashNumber keyHash,
|
||||
const void *key, void *value);
|
||||
|
||||
JS_EXTERN_API(void)
|
||||
EXTERN(void)
|
||||
JS_HashTableRawRemove(JSHashTable *ht, JSHashEntry **hep, JSHashEntry *he);
|
||||
|
||||
/* Higher level access methods */
|
||||
JS_EXTERN_API(JSHashEntry *)
|
||||
EXTERN(JSHashEntry *)
|
||||
JS_HashTableAdd(JSHashTable *ht, const void *key, void *value);
|
||||
|
||||
JS_EXTERN_API(JSBool)
|
||||
EXTERN(JSBool)
|
||||
JS_HashTableRemove(JSHashTable *ht, const void *key);
|
||||
|
||||
JS_EXTERN_API(intN)
|
||||
EXTERN(intN)
|
||||
JS_HashTableEnumerateEntries(JSHashTable *ht, JSHashEnumerator f, void *arg);
|
||||
|
||||
JS_EXTERN_API(void *)
|
||||
EXTERN(void *)
|
||||
JS_HashTableLookup(JSHashTable *ht, const void *key);
|
||||
|
||||
JS_EXTERN_API(intN)
|
||||
EXTERN(intN)
|
||||
JS_HashTableDump(JSHashTable *ht, JSHashEnumerator dump, FILE *fp);
|
||||
|
||||
/* General-purpose C string hash function. */
|
||||
JS_EXTERN_API(JSHashNumber)
|
||||
EXTERN(JSHashNumber)
|
||||
JS_HashString(const void *key);
|
||||
|
||||
/* Stub function just returns v1 == v2 */
|
||||
JS_EXTERN_API(intN)
|
||||
IMPLEMENT(intN)
|
||||
JS_CompareValues(const void *v1, const void *v2);
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
||||
@@ -75,14 +75,8 @@
|
||||
"PR_MapEvents",
|
||||
"PR_RevokeEvents",
|
||||
|
||||
"PR_cnvtf",
|
||||
"PR_dtoa",
|
||||
"PR_strtod",
|
||||
|
||||
"PRFileDesc",
|
||||
|
||||
"PR_HASH_BITS",
|
||||
"PR_GOLDEN_RATIO",
|
||||
"PRHashAllocOps",
|
||||
"PRHashComparator",
|
||||
"PRHashEntry",
|
||||
@@ -396,13 +390,17 @@ sub convert_includes {
|
||||
}
|
||||
|
||||
if ($line =~ /prlog\.h/) {
|
||||
$line = '#include "jsutil.h"'. " /* Added by JSIFY */\n";
|
||||
chop $line;
|
||||
$line = "/* Removed by JSIFY: $line */\n";
|
||||
$line .= '#include "jsutil.h"'. " /* Added by JSIFY */\n";
|
||||
} elsif ($line =~ /plhash\.h/) {
|
||||
$line = '#include "jshash.h"'. " /* Added by JSIFY */\n";
|
||||
$line = "/* Removed by JSIFY: $line */\n";
|
||||
$line .= '#include "jshash.h"'. " /* Added by JSIFY */\n";
|
||||
} elsif ($line =~ /plarena\.h/) {
|
||||
$line = '#include "jsarena.h"'. " /* Added by JSIFY */\n";
|
||||
$line = "/* Removed by JSIFY: $line */\n";
|
||||
$line .= '#include "jsarena.h"'. " /* Added by JSIFY */\n";
|
||||
} elsif ($line =~ /prmem\.h/) {
|
||||
$line = "";
|
||||
$line = "/* Removed by JSIFY: $line */\n";
|
||||
} elsif ($line =~ /jsmsg\.def/) {
|
||||
$line = '#include "js.msg"' . "\n";
|
||||
} elsif ($line =~ /shellmsg\.def/) {
|
||||
@@ -415,14 +413,13 @@ sub convert_includes {
|
||||
|
||||
sub convert_declarations {
|
||||
($line) = @_;
|
||||
$line =~ s/PR_EXTERN/JS_EXTERN_API/g;
|
||||
$line =~ s/PR_IMPLEMENT_DATA/JS_EXPORT_DATA/g;
|
||||
$line =~ s/PR_IMPLEMENT/JS_EXPORT_API/g;
|
||||
$line =~ s/PR_CALLBACK/JS_DLL_CALLBACK/g;
|
||||
$line =~ s/PR_STATIC_CALLBACK/JS_STATIC_DLL_CALLBACK/g;
|
||||
$line =~ s/PR_IMPORT/JS_IMPORT/g;
|
||||
$line =~ s/PR_PUBLIC_API/JS_EXPORT_API/g;
|
||||
$line =~ s/PR_PUBLIC_DATA/JS_EXPORT_DATA/g;
|
||||
$line =~ s/PR_EXTERN/EXTERN/g;
|
||||
$line =~ s/PR_IMPLEMENT/IMPLEMENT/g;
|
||||
$line =~ s/PR_CALLBACK/DLL_CALLBACK/g;
|
||||
$line =~ s/PR_STATIC_CALLBACK/STATIC_DLL_CALLBACK/g;
|
||||
$line =~ s/PR_IMPORT/IMPORT/g;
|
||||
$line =~ s/PR_PUBLIC_API/PUBLIC_API/g;
|
||||
$line =~ s/PR_PUBLIC_DATA/PUBLIC_DATA/g;
|
||||
return $line;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,14 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "jstypes.h"
|
||||
#ifndef NSPR20
|
||||
#include "jsarena.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "plarena.h"
|
||||
*/
|
||||
#include "jsarena.h" /* Added by JSIFY */
|
||||
#endif
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsprf.h"
|
||||
#include "jsapi.h"
|
||||
@@ -1085,13 +1092,6 @@ js_Interpret(JSContext *cx, jsval *result)
|
||||
case JSTRAP_RETURN:
|
||||
fp->rval = rval;
|
||||
goto out;
|
||||
#if JS_HAS_EXCEPTIONS
|
||||
case JSTRAP_THROW:
|
||||
cx->throwing = JS_TRUE;
|
||||
cx->exception = rval;
|
||||
ok = JS_FALSE;
|
||||
goto out;
|
||||
#endif /* JS_HAS_EXCEPTIONS */
|
||||
default:;
|
||||
}
|
||||
}
|
||||
@@ -1909,8 +1909,7 @@ js_Interpret(JSContext *cx, jsval *result)
|
||||
/* XXX clean up to avoid special cases above ObjectOps layer */
|
||||
(clasp = OBJ_GET_CLASS(cx, obj2),
|
||||
clasp == &js_FunctionClass || clasp == &js_ClosureClass) ||
|
||||
!obj2->map->ops->construct)
|
||||
{
|
||||
!obj2->map->ops->construct) {
|
||||
fun = js_ValueToFunction(cx, vp, JS_TRUE);
|
||||
if (!fun) {
|
||||
ok = JS_FALSE;
|
||||
@@ -1933,32 +1932,11 @@ js_Interpret(JSContext *cx, jsval *result)
|
||||
parent = OBJ_GET_PARENT(cx, obj2);
|
||||
}
|
||||
|
||||
#if 1
|
||||
/* If there is no class prototype, use js_ObjectClass. */
|
||||
if (!proto)
|
||||
obj = js_NewObject(cx, &js_ObjectClass, NULL, parent);
|
||||
else
|
||||
obj = js_NewObject(cx, OBJ_GET_CLASS(cx, proto), proto, parent);
|
||||
#else
|
||||
clasp = &js_ObjectClass;
|
||||
if (!JSVAL_IS_PRIMITIVE(lval)) {
|
||||
/*
|
||||
* Use prototype's class iff we are calling the class's
|
||||
* constuctor.
|
||||
*/
|
||||
JSObject *funobj;
|
||||
|
||||
funobj = JSVAL_TO_OBJECT(lval);
|
||||
clasp = OBJ_GET_CLASS(cx, funobj);
|
||||
if (clasp == &js_FunctionClass &&
|
||||
((JSFunction *)JS_GetPrivate(cx, funobj))->call ==
|
||||
OBJ_GET_CLASS(cx, proto)->construct)
|
||||
{
|
||||
clasp = OBJ_GET_CLASS(cx, proto);
|
||||
}
|
||||
}
|
||||
obj = js_NewObject(cx, clasp, proto, parent);
|
||||
#endif
|
||||
if (!obj) {
|
||||
ok = JS_FALSE;
|
||||
goto out;
|
||||
@@ -1971,6 +1949,10 @@ js_Interpret(JSContext *cx, jsval *result)
|
||||
RESTORE_SP(fp);
|
||||
if (!ok) {
|
||||
cx->newborn[GCX_OBJECT] = NULL;
|
||||
#if JS_HAS_EXCEPTIONS
|
||||
if (cx->throwing)
|
||||
goto do_throw;
|
||||
#endif
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -2180,13 +2162,16 @@ js_Interpret(JSContext *cx, jsval *result)
|
||||
PUSH_OPND(OBJECT_TO_JSVAL(obj));
|
||||
break;
|
||||
|
||||
case JSOP_CALLSPECIAL:
|
||||
case JSOP_CALL:
|
||||
argc = GET_ARGC(pc);
|
||||
SAVE_SP(fp);
|
||||
ok = js_Invoke(cx, argc, JS_FALSE);
|
||||
RESTORE_SP(fp);
|
||||
if (!ok) {
|
||||
#if JS_HAS_EXCEPTIONS
|
||||
if (cx->throwing)
|
||||
goto do_throw;
|
||||
#endif
|
||||
goto out;
|
||||
}
|
||||
obj = NULL;
|
||||
@@ -2293,6 +2278,7 @@ js_Interpret(JSContext *cx, jsval *result)
|
||||
* ECMAv2 forbids conversion of discriminant, so we will skip to
|
||||
* the default case if the discriminant isn't an int jsval.
|
||||
* (This opcode is emitted only for dense jsint-domain switches.)
|
||||
* XXX don't use JSVERSION_IS_ECMAv2, it's wrong and overloaded
|
||||
*/
|
||||
if (cx->version == JSVERSION_DEFAULT ||
|
||||
cx->version >= JSVERSION_1_4) {
|
||||
@@ -2533,13 +2519,6 @@ js_Interpret(JSContext *cx, jsval *result)
|
||||
case JSTRAP_RETURN:
|
||||
fp->rval = rval;
|
||||
goto out;
|
||||
#if JS_HAS_EXCEPTIONS
|
||||
case JSTRAP_THROW:
|
||||
cx->throwing = JS_TRUE;
|
||||
cx->exception = rval;
|
||||
ok = JS_FALSE;
|
||||
goto out;
|
||||
#endif /* JS_HAS_EXCEPTIONS */
|
||||
default:;
|
||||
}
|
||||
break;
|
||||
@@ -2698,8 +2677,22 @@ js_Interpret(JSContext *cx, jsval *result)
|
||||
case JSOP_THROW:
|
||||
cx->throwing = JS_TRUE;
|
||||
cx->exception = POP();
|
||||
do_throw:
|
||||
tn = script->trynotes;
|
||||
offset = PTRDIFF(pc, script->code, jsbytecode);
|
||||
if (tn) {
|
||||
while (JS_UPTRDIFF(offset, tn->start) >= (jsuword)tn->length)
|
||||
tn++;
|
||||
if (tn->catchStart) {
|
||||
pc = script->code + tn->catchStart;
|
||||
len = 0;
|
||||
cx->throwing = JS_FALSE; /* caught */
|
||||
goto advance_pc;
|
||||
}
|
||||
}
|
||||
|
||||
/* Not in a catch block, so propagate the exception. */
|
||||
ok = JS_FALSE;
|
||||
/* let the code at out try to catch the exception. */
|
||||
goto out;
|
||||
#endif /* JS_HAS_EXCEPTIONS */
|
||||
|
||||
@@ -2745,13 +2738,6 @@ js_Interpret(JSContext *cx, jsval *result)
|
||||
case JSTRAP_RETURN:
|
||||
fp->rval = rval;
|
||||
goto out;
|
||||
#if JS_HAS_EXCEPTIONS
|
||||
case JSTRAP_THROW:
|
||||
cx->throwing = JS_TRUE;
|
||||
cx->exception = rval;
|
||||
ok = JS_FALSE;
|
||||
goto out;
|
||||
#endif /* JS_HAS_EXCEPTIONS */
|
||||
default:;
|
||||
}
|
||||
}
|
||||
@@ -2794,29 +2780,6 @@ js_Interpret(JSContext *cx, jsval *result)
|
||||
#endif
|
||||
}
|
||||
out:
|
||||
|
||||
#if JS_HAS_EXCEPTIONS
|
||||
if (!ok && cx->throwing) {
|
||||
/*
|
||||
* Check if an exception has been raised. If so, there may be
|
||||
* a try block within this frame that can catch the exception.
|
||||
*/
|
||||
tn = script->trynotes;
|
||||
if (tn) {
|
||||
offset = PTRDIFF(pc, script->code, jsbytecode);
|
||||
while (JS_UPTRDIFF(offset, tn->start) >= (jsuword)tn->length)
|
||||
tn++;
|
||||
if (tn->catchStart) {
|
||||
pc = script->code + tn->catchStart;
|
||||
len = 0;
|
||||
cx->throwing = JS_FALSE; /* caught */
|
||||
ok = JS_TRUE;
|
||||
goto advance_pc;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Restore the previous frame's execution state.
|
||||
*/
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "jspubtd.h"
|
||||
#include "prthread.h"
|
||||
#include "pratom.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jscntxt.h"
|
||||
#include "jsscope.h"
|
||||
@@ -101,12 +102,12 @@ js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
|
||||
#if defined(__GNUC__)
|
||||
unsigned int res;
|
||||
#ifndef ULTRA_SPARC
|
||||
JS_ASSERT(nv != -1);
|
||||
JS_ASSERT(nv >= 0);
|
||||
asm volatile ("
|
||||
stbar
|
||||
swap [%1],%4
|
||||
1: cmp %4,-1
|
||||
be,a 1b
|
||||
1: tst %4
|
||||
bneg,a 1b
|
||||
swap [%1],%4
|
||||
cmp %2,%4
|
||||
be,a 2f
|
||||
@@ -135,7 +136,7 @@ mov 0,%0
|
||||
#else /* !__GNUC__ */
|
||||
extern int compare_and_swap(jsword*,jsword,jsword);
|
||||
#ifndef ULTRA_SPARC
|
||||
JS_ASSERT(nv != -1);
|
||||
JS_ASSERT(nv >= 0);
|
||||
#else
|
||||
JS_ASSERT(ov != nv);
|
||||
#endif
|
||||
@@ -188,7 +189,7 @@ js_AtomicAdd(jsword *p, jsword i)
|
||||
AtomicAddBody(p,i);
|
||||
}
|
||||
|
||||
static JS_INLINE jsword
|
||||
JS_INLINE jsword
|
||||
js_AtomicSet(jsword *p, jsword n)
|
||||
{
|
||||
jsword o;
|
||||
@@ -307,7 +308,7 @@ mallocFatlock()
|
||||
fl->next = NULL;
|
||||
fl->prev = NULL;
|
||||
fl->slock = PR_NewLock();
|
||||
fl->svar = PR_NewCondVar(fl->slock);
|
||||
fl->svar = JS_NewCondVar(fl->slock);
|
||||
return fl;
|
||||
}
|
||||
|
||||
@@ -326,7 +327,7 @@ js_SuspendThread(JSThinLock *p)
|
||||
JSStatus stat;
|
||||
|
||||
while ((fl = (JSFatLock*)js_AtomicSet((jsword*)&p->fat,1)) == (JSFatLock*)1) /* busy wait */
|
||||
PR_Sleep(PR_INTERVAL_NO_WAIT);
|
||||
PR_Sleep(JS_INTERVAL_NO_WAIT);
|
||||
if (fl == NULL)
|
||||
return 1;
|
||||
PR_Lock(fl->slock);
|
||||
@@ -336,7 +337,7 @@ js_SuspendThread(JSThinLock *p)
|
||||
PR_Unlock(fl->slock);
|
||||
return 1;
|
||||
}
|
||||
stat = PR_WaitCondVar(fl->svar,PR_INTERVAL_NO_TIMEOUT);
|
||||
stat = PR_WaitCondVar(fl->svar,JS_INTERVAL_NO_TIMEOUT);
|
||||
if (stat == JS_FAILURE) {
|
||||
fl->susp--;
|
||||
return 0;
|
||||
@@ -352,7 +353,7 @@ js_ResumeThread(JSThinLock *p)
|
||||
JSStatus stat;
|
||||
|
||||
while ((fl = (JSFatLock*)js_AtomicSet((jsword*)&p->fat,1)) == (JSFatLock*)1)
|
||||
PR_Sleep(PR_INTERVAL_NO_WAIT);
|
||||
PR_Sleep(JS_INTERVAL_NO_WAIT);
|
||||
if (fl == NULL)
|
||||
return;
|
||||
PR_Lock(fl->slock);
|
||||
@@ -395,7 +396,7 @@ deleteListOfFatlocks(JSFatLock *m)
|
||||
|
||||
static JSFatLockTable _fl_table;
|
||||
|
||||
static JSFatLock *
|
||||
JSFatLock *
|
||||
allocateFatlock()
|
||||
{
|
||||
JSFatLock *m;
|
||||
@@ -420,7 +421,7 @@ allocateFatlock()
|
||||
return m;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
deallocateFatlock(JSFatLock *m)
|
||||
{
|
||||
if (m == NULL)
|
||||
@@ -437,7 +438,7 @@ deallocateFatlock(JSFatLock *m)
|
||||
js_UnlockGlobal();
|
||||
}
|
||||
|
||||
int
|
||||
JS_PUBLIC_API(int)
|
||||
js_SetupLocks(int l)
|
||||
{
|
||||
if (l > 10000) /* l equals number of initially allocated fat locks */
|
||||
@@ -461,7 +462,7 @@ js_SetupLocks(int l)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
JS_PUBLIC_API(void)
|
||||
js_CleanupLocks()
|
||||
{
|
||||
if (_global_lock != NULL) {
|
||||
@@ -511,7 +512,7 @@ js_InitContextForLocking(JSContext *cx)
|
||||
|
||||
*/
|
||||
|
||||
static int
|
||||
int
|
||||
emptyFatlock(JSThinLock *p)
|
||||
{
|
||||
JSFatLock *fl;
|
||||
@@ -519,7 +520,7 @@ emptyFatlock(JSThinLock *p)
|
||||
PRLock* lck;
|
||||
|
||||
while ((fl = (JSFatLock*)js_AtomicSet((jsword*)&p->fat,1)) == (JSFatLock*)1)
|
||||
PR_Sleep(PR_INTERVAL_NO_WAIT);
|
||||
PR_Sleep(JS_INTERVAL_NO_WAIT);
|
||||
if (fl == NULL) {
|
||||
js_AtomicSet((jsword*)&p->fat,(jsword)fl);
|
||||
return 1;
|
||||
@@ -584,7 +585,7 @@ js_Enqueue(JSThinLock *p, jsword me)
|
||||
if (o != 0 && js_CompareAndSwap(&p->owner,o,n)) {
|
||||
JSFatLock* fl;
|
||||
while ((fl = (JSFatLock*)js_AtomicSet((jsword*)&p->fat,1)) == (JSFatLock*)1)
|
||||
PR_Sleep(PR_INTERVAL_NO_WAIT);
|
||||
PR_Sleep(JS_INTERVAL_NO_WAIT);
|
||||
if (fl == NULL)
|
||||
fl = allocateFatlock();
|
||||
js_AtomicSet((jsword*)&p->fat,(jsword)fl);
|
||||
@@ -660,7 +661,7 @@ js_UnlockRuntime(JSRuntime *rt)
|
||||
JS_UNLOCK0(p,me);
|
||||
}
|
||||
|
||||
static JS_INLINE void
|
||||
JS_INLINE void
|
||||
js_LockScope1(JSContext *cx, JSScope *scope, jsword me)
|
||||
{
|
||||
JSThinLock *p;
|
||||
|
||||
@@ -23,7 +23,13 @@
|
||||
#include "jstypes.h"
|
||||
#include "prlock.h"
|
||||
#include "prcvar.h"
|
||||
#ifndef NSPR20
|
||||
#include "jshash.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "JShash.h"
|
||||
*/
|
||||
#include "jshash.h" /* Added by JSIFY */
|
||||
#endif
|
||||
|
||||
#define Thin_GetWait(W) ((jsword)(W) & 0x1)
|
||||
#define Thin_SetWait(W) ((jsword)(W) | 0x1)
|
||||
@@ -60,10 +66,10 @@ typedef struct JSFatLockTable {
|
||||
#define JS_LOCK0(P,M) js_Lock(P,M)
|
||||
#define JS_UNLOCK0(P,M) js_Unlock(P,M)
|
||||
|
||||
#define JS_NEW_CONDVAR(l) PR_NewCondVar(l)
|
||||
#define JS_NEW_CONDVAR(l) JS_NewCondVar(l)
|
||||
#define JS_DESTROY_CONDVAR(cv) PR_DestroyCondVar(cv)
|
||||
#define JS_WAIT_CONDVAR(cv,to) PR_WaitCondVar(cv,to)
|
||||
#define JS_NO_TIMEOUT PR_INTERVAL_NO_TIMEOUT
|
||||
#define JS_NO_TIMEOUT JS_INTERVAL_NO_TIMEOUT
|
||||
#define JS_NOTIFY_CONDVAR(cv) PR_NotifyCondVar(cv)
|
||||
#define JS_NOTIFY_ALL_CONDVAR(cv) PR_NotifyAllCondVar(cv)
|
||||
|
||||
@@ -100,8 +106,8 @@ extern void js_LockObj(JSContext *cx, JSObject *obj);
|
||||
extern void js_UnlockObj(JSContext *cx, JSObject *obj);
|
||||
extern void js_LockScope(JSContext *cx, JSScope *scope);
|
||||
extern void js_UnlockScope(JSContext *cx, JSScope *scope);
|
||||
extern int js_SetupLocks(int);
|
||||
extern void js_CleanupLocks();
|
||||
extern JS_PUBLIC_API(int) js_SetupLocks(int);
|
||||
extern JS_PUBLIC_API(void) js_CleanupLocks();
|
||||
extern JS_PUBLIC_API(void) js_InitContextForLocking(JSContext *);
|
||||
extern void js_TransferScopeLock(JSContext *, JSScope *, JSScope *);
|
||||
extern JS_PUBLIC_API(jsval) js_GetSlotWhileLocked(JSContext *, JSObject *, uint32);
|
||||
@@ -140,7 +146,7 @@ extern JSBool js_IsScopeLocked(JSScope *scope);
|
||||
JS_LOCK_RUNTIME_VOID(_rt, e); \
|
||||
JS_END_MACRO
|
||||
|
||||
#if defined(JS_USE_ONLY_NSPR_LOCKS) || !(defined(_WIN32) || defined(SOLARIS) || defined(AIX))
|
||||
#if defined(JS_ONLY_NSPR_LOCKS) || !(defined(_WIN32) || defined(SOLARIS) || defined(AIX))
|
||||
|
||||
#undef JS_LOCK0
|
||||
#undef JS_UNLOCK0
|
||||
|
||||
233
mozilla/js/src/jslog.h
Normal file
233
mozilla/js/src/jslog.h
Normal file
@@ -0,0 +1,233 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef jslog_h___
|
||||
#define jslog_h___
|
||||
|
||||
#include "jstypes.h"
|
||||
|
||||
JS_BEGIN_EXTERN_C
|
||||
|
||||
/*
|
||||
/* Removed by JSIFY: ** prlog.h -- Declare interfaces to NSPR's Logging service */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
**
|
||||
** NSPR provides a logging service that is used by NSPR itself and is
|
||||
** available to client programs.
|
||||
**
|
||||
** To use the service from a client program, you should create a
|
||||
** PRLogModuleInfo structure by calling JS_NewLogModule(). After
|
||||
** creating the LogModule, you can write to the log using the JS_LOG()
|
||||
** macro.
|
||||
**
|
||||
** Initialization of the log service is handled by NSPR initialization.
|
||||
**
|
||||
** At execution time, you must enable the log service. To enable the
|
||||
** log service, set the environment variable: NSPR_LOG_MODULES
|
||||
** variable.
|
||||
**
|
||||
** NSPR_LOG_MODULES variable has the form:
|
||||
**
|
||||
** <moduleName>:<value>[, <moduleName>:<value>]*
|
||||
**
|
||||
** Where:
|
||||
** <moduleName> is the name passed to JS_NewLogModule().
|
||||
** <value> is a numeric constant, e.g. 5. This value is the maximum
|
||||
** value of a log event, enumerated by PRLogModuleLevel, that you want
|
||||
** written to the log.
|
||||
**
|
||||
** For example: to record all events of greater value than or equal to
|
||||
** JS_LOG_ERROR for a LogModule names "gizmo", say:
|
||||
**
|
||||
** set NSPR_LOG_MODULES=gizmo:2
|
||||
**
|
||||
** Note that you must specify the numeric value of JS_LOG_ERROR.
|
||||
**
|
||||
** Special LogModule names are provided for controlling NSPR's log
|
||||
** service at execution time. These controls should be set in the
|
||||
** NSPR_LOG_MODULES environment variable at execution time to affect
|
||||
** NSPR's log service for your application.
|
||||
**
|
||||
** The special LogModule "all" enables all LogModules. To enable all
|
||||
** LogModule calls to JS_LOG(), say:
|
||||
**
|
||||
** set NSPR_LOG_MODULES=all:5
|
||||
**
|
||||
** The special LogModule name "sync" tells the NSPR log service to do
|
||||
** unbuffered logging.
|
||||
**
|
||||
** The special LogModule name "buffsize:<size>" tells NSPR to set the
|
||||
** log buffer to <size>.
|
||||
**
|
||||
** The environment variable NSPR_LOG_FILE specifies the log file to use
|
||||
** unless the default of "stderr" is acceptable.
|
||||
**
|
||||
** To put log messages in your programs, use the JS_LOG macro:
|
||||
**
|
||||
** JS_LOG(<module>, <level>, (<printfString>, <args>*));
|
||||
**
|
||||
** Where <module> is the address of a PRLogModuleInfo structure, and
|
||||
** <level> is one of the levels defined by the enumeration:
|
||||
** PRLogModuleLevel. <args> is a printf() style of argument list. That
|
||||
** is: (fmtstring, ...).
|
||||
**
|
||||
** Example:
|
||||
**
|
||||
** main() {
|
||||
** JSIntn one = 1;
|
||||
** PRLogModuleInfo * myLm = JS_NewLogModule("gizmo");
|
||||
** JS_LOG( myLm, JS_LOG_ALWAYS, ("Log this! %d\n", one));
|
||||
** return;
|
||||
** }
|
||||
**
|
||||
** Note the use of printf() style arguments as the third agrument(s) to
|
||||
** JS_LOG().
|
||||
**
|
||||
** After compiling and linking you application, set the environment:
|
||||
**
|
||||
** SET NSPR_LOGMODULES=gizmo:5
|
||||
** SET NSPR_LOG_FILE=logfile.txt
|
||||
**
|
||||
** When you execute your application, the string "Log this! 1" will be
|
||||
** written to the file "logfile.txt".
|
||||
**
|
||||
** Note to NSPR engineers: a number of PRLogModuleInfo structures are
|
||||
** defined and initialized in prinit.c. See this module for ideas on
|
||||
** what to log where.
|
||||
**
|
||||
*/
|
||||
|
||||
typedef enum PRLogModuleLevel {
|
||||
JS_LOG_NONE = 0, /* nothing */
|
||||
JS_LOG_ALWAYS = 1, /* always printed */
|
||||
JS_LOG_ERROR = 2, /* error messages */
|
||||
JS_LOG_WARNING = 3, /* warning messages */
|
||||
JS_LOG_DEBUG = 4, /* debug messages */
|
||||
|
||||
JS_LOG_NOTICE = JS_LOG_DEBUG, /* notice messages */
|
||||
JS_LOG_WARN = JS_LOG_WARNING, /* warning messages */
|
||||
JS_LOG_MIN = JS_LOG_DEBUG, /* minimal debugging messages */
|
||||
JS_LOG_MAX = JS_LOG_DEBUG /* maximal debugging messages */
|
||||
} PRLogModuleLevel;
|
||||
|
||||
/*
|
||||
** One of these structures is created for each module that uses logging.
|
||||
** "name" is the name of the module
|
||||
** "level" is the debugging level selected for that module
|
||||
*/
|
||||
typedef struct PRLogModuleInfo {
|
||||
const char *name;
|
||||
PRLogModuleLevel level;
|
||||
struct PRLogModuleInfo *next;
|
||||
} PRLogModuleInfo;
|
||||
|
||||
/*
|
||||
** Create a new log module.
|
||||
*/
|
||||
EXTERN(PRLogModuleInfo*) JS_NewLogModule(const char *name);
|
||||
|
||||
/*
|
||||
** Set the file to use for logging. Returns JS_FALSE if the file cannot
|
||||
** be created
|
||||
*/
|
||||
EXTERN(JSBool) JS_SetLogFile(const char *name);
|
||||
|
||||
/*
|
||||
** Set the size of the logging buffer. If "buffer_size" is zero then the
|
||||
** logging becomes "synchronous" (or unbuffered).
|
||||
*/
|
||||
EXTERN(void) JS_SetLogBuffering(JSIntn buffer_size);
|
||||
|
||||
/*
|
||||
** Print a string to the log. "fmt" is a PR_snprintf format type. All
|
||||
** messages printed to the log are preceeded by the name of the thread
|
||||
** and a time stamp. Also, the routine provides a missing newline if one
|
||||
** is not provided.
|
||||
*/
|
||||
EXTERN(void) JS_LogPrint(const char *fmt, ...);
|
||||
|
||||
/*
|
||||
** Flush the log to its file.
|
||||
*/
|
||||
EXTERN(void) JS_LogFlush(void);
|
||||
|
||||
/*
|
||||
** Windoze 16 can't support a large static string space for all of the
|
||||
** various debugging strings so logging is not enabled for it.
|
||||
*/
|
||||
#if (defined(DEBUG) || defined(FORCE_PR_LOG)) && !defined(WIN16)
|
||||
#define JS_LOGGING 1
|
||||
|
||||
#define JS_LOG_TEST(_module,_level) \
|
||||
((_module)->level >= (_level))
|
||||
|
||||
/*
|
||||
** Log something.
|
||||
** "module" is the address of a PRLogModuleInfo structure
|
||||
** "level" is the desired logging level
|
||||
** "args" is a variable length list of arguments to print, in the following
|
||||
** format: ("printf style format string", ...)
|
||||
*/
|
||||
#define JS_LOG(_module,_level,_args) \
|
||||
JS_BEGIN_MACRO \
|
||||
if (JS_LOG_TEST(_module,_level)) { \
|
||||
JS_LogPrint _args; \
|
||||
} \
|
||||
JS_END_MACRO
|
||||
|
||||
#else /* (defined(DEBUG) || defined(FORCE_PR_LOG)) && !defined(WIN16) */
|
||||
|
||||
#undef JS_LOGGING
|
||||
#define JS_LOG_TEST(module,level) 0
|
||||
#define JS_LOG(module,level,args)
|
||||
|
||||
#endif /* (defined(DEBUG) || defined(FORCE_PR_LOG)) && !defined(WIN16) */
|
||||
|
||||
#ifndef NO_NSPR_10_SUPPORT
|
||||
|
||||
#ifdef JS_LOGGING
|
||||
#define JS_LOG_BEGIN JS_LOG
|
||||
#define JS_LOG_END JS_LOG
|
||||
#define JS_LOG_DEFINE JS_NewLogModule
|
||||
#else
|
||||
#define JS_LOG_BEGIN(module,level,args)
|
||||
#define JS_LOG_END(module,level,args)
|
||||
#define JS_LOG_DEFINE(_name) NULL
|
||||
#endif /* JS_LOGGING */
|
||||
|
||||
#endif /* NO_NSPR_10_SUPPORT */
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
EXTERN(void) JS_Assert(const char *s, const char *file, JSIntn ln);
|
||||
#define JS_ASSERT(_expr) \
|
||||
((_expr)?((void)0):JS_Assert(# _expr,__FILE__,__LINE__))
|
||||
|
||||
#define JS_NOT_REACHED(_reasonStr) \
|
||||
JS_Assert(_reasonStr,__FILE__,__LINE__)
|
||||
|
||||
#else
|
||||
|
||||
#define JS_ASSERT(expr) ((void) 0)
|
||||
#define JS_NOT_REACHED(reasonStr)
|
||||
|
||||
#endif /* defined(DEBUG) */
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
||||
#endif /* jslog_h___ */
|
||||
@@ -21,7 +21,7 @@
|
||||
/*
|
||||
** Compute the log of the least power of 2 greater than or equal to n
|
||||
*/
|
||||
JS_EXPORT_API(JSIntn) JS_CeilingLog2(JSUint32 n)
|
||||
IMPLEMENT(JSIntn) JS_CeilingLog2(JSUint32 n)
|
||||
{
|
||||
JSIntn log2 = 0;
|
||||
|
||||
@@ -44,7 +44,7 @@ JS_EXPORT_API(JSIntn) JS_CeilingLog2(JSUint32 n)
|
||||
** Compute the log of the greatest power of 2 less than or equal to n.
|
||||
** This really just finds the highest set bit in the word.
|
||||
*/
|
||||
JS_EXPORT_API(JSIntn) JS_FloorLog2(JSUint32 n)
|
||||
IMPLEMENT(JSIntn) JS_FloorLog2(JSUint32 n)
|
||||
{
|
||||
JSIntn log2 = 0;
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ JSInt64 __pascal __loadds __export
|
||||
JSInt64 __pascal __loadds __export
|
||||
JSLL_MinInt(void) { return ll_minint; }
|
||||
#else
|
||||
JS_EXPORT_API(JSInt64) JSLL_Zero(void) { return ll_zero; }
|
||||
JS_EXPORT_API(JSInt64) JSLL_MaxInt(void) { return ll_maxint; }
|
||||
JS_EXPORT_API(JSInt64) JSLL_MinInt(void) { return ll_minint; }
|
||||
IMPLEMENT(JSInt64) JSLL_Zero(void) { return ll_zero; }
|
||||
IMPLEMENT(JSInt64) JSLL_MaxInt(void) { return ll_maxint; }
|
||||
IMPLEMENT(JSInt64) JSLL_MinInt(void) { return ll_minint; }
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LONG_LONG
|
||||
@@ -45,12 +45,12 @@ static void norm_udivmod32(JSUint32 *qp, JSUint32 *rp, JSUint64 a, JSUint32 b)
|
||||
JSUint32 d1, d0, q1, q0;
|
||||
JSUint32 r1, r0, m;
|
||||
|
||||
d1 = jshi16(b);
|
||||
d0 = jslo16(b);
|
||||
d1 = _hi16(b);
|
||||
d0 = _lo16(b);
|
||||
r1 = a.hi % d1;
|
||||
q1 = a.hi / d1;
|
||||
m = q1 * d0;
|
||||
r1 = (r1 << 16) | jshi16(a.lo);
|
||||
r1 = (r1 << 16) | _hi16(a.lo);
|
||||
if (r1 < m) {
|
||||
q1--, r1 += b;
|
||||
if (r1 >= b /* i.e., we didn't get a carry when adding to r1 */
|
||||
@@ -62,7 +62,7 @@ static void norm_udivmod32(JSUint32 *qp, JSUint32 *rp, JSUint64 a, JSUint32 b)
|
||||
r0 = r1 % d1;
|
||||
q0 = r1 / d1;
|
||||
m = q0 * d0;
|
||||
r0 = (r0 << 16) | jslo16(a.lo);
|
||||
r0 = (r0 << 16) | _lo16(a.lo);
|
||||
if (r0 < m) {
|
||||
q0--, r0 += b;
|
||||
if (r0 >= b
|
||||
@@ -94,7 +94,7 @@ static JSUint32 CountLeadingZeros(JSUint32 a)
|
||||
return r;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(void) jsll_udivmod(JSUint64 *qp, JSUint64 *rp, JSUint64 a, JSUint64 b)
|
||||
IMPLEMENT(void) ll_udivmod(JSUint64 *qp, JSUint64 *rp, JSUint64 a, JSUint64 b)
|
||||
{
|
||||
JSUint32 n0, n1, n2;
|
||||
JSUint32 q0, q1;
|
||||
|
||||
@@ -47,9 +47,9 @@ JSInt64 __pascal __loadds __export
|
||||
JSInt64 __pascal __loadds __export
|
||||
JSLL_Zero(void);
|
||||
#else
|
||||
JS_EXTERN_API(JSInt64) JSLL_MaxInt(void);
|
||||
JS_EXTERN_API(JSInt64) JSLL_MinInt(void);
|
||||
JS_EXTERN_API(JSInt64) JSLL_Zero(void);
|
||||
EXTERN(JSInt64) JSLL_MaxInt(void);
|
||||
EXTERN(JSInt64) JSLL_MinInt(void);
|
||||
EXTERN(JSInt64) JSLL_Zero(void);
|
||||
#endif
|
||||
|
||||
#define JSLL_MAXINT JSLL_MaxInt()
|
||||
@@ -227,28 +227,28 @@ JS_EXTERN_API(JSInt64) JSLL_Zero(void);
|
||||
(r).hi += _a.hi * _b.lo + _a.lo * _b.hi; \
|
||||
}
|
||||
|
||||
#define jslo16(a) ((a) & JS_BITMASK(16))
|
||||
#define jshi16(a) ((a) >> 16)
|
||||
#define _lo16(a) ((a) & JS_BITMASK(16))
|
||||
#define _hi16(a) ((a) >> 16)
|
||||
|
||||
#define JSLL_MUL32(r, a, b) { \
|
||||
JSUint32 _a1, _a0, _b1, _b0, _y0, _y1, _y2, _y3; \
|
||||
_a1 = jshi16(a), _a0 = jslo16(a); \
|
||||
_b1 = jshi16(b), _b0 = jslo16(b); \
|
||||
_a1 = _hi16(a), _a0 = _lo16(a); \
|
||||
_b1 = _hi16(b), _b0 = _lo16(b); \
|
||||
_y0 = _a0 * _b0; \
|
||||
_y1 = _a0 * _b1; \
|
||||
_y2 = _a1 * _b0; \
|
||||
_y3 = _a1 * _b1; \
|
||||
_y1 += jshi16(_y0); /* can't carry */ \
|
||||
_y1 += _hi16(_y0); /* can't carry */ \
|
||||
_y1 += _y2; /* might carry */ \
|
||||
if (_y1 < _y2) \
|
||||
_y3 += (JSUint32)(JS_BIT(16)); /* propagate */ \
|
||||
(r).lo = (jslo16(_y1) << 16) + jslo16(_y0); \
|
||||
(r).hi = _y3 + jshi16(_y1); \
|
||||
(r).lo = (_lo16(_y1) << 16) + _lo16(_y0); \
|
||||
(r).hi = _y3 + _hi16(_y1); \
|
||||
}
|
||||
|
||||
#define JSLL_UDIVMOD(qp, rp, a, b) jsll_udivmod(qp, rp, a, b)
|
||||
#define JSLL_UDIVMOD(qp, rp, a, b) ll_udivmod(qp, rp, a, b)
|
||||
|
||||
JS_EXTERN_API(void) jsll_udivmod(JSUint64 *qp, JSUint64 *rp, JSUint64 a, JSUint64 b);
|
||||
EXTERN(void) ll_udivmod(JSUint64 *qp, JSUint64 *rp, JSUint64 a, JSUint64 b);
|
||||
|
||||
#define JSLL_DIV(r, a, b) { \
|
||||
JSInt64 _a, _b; \
|
||||
|
||||
37
mozilla/js/src/jsmacos.h
Normal file
37
mozilla/js/src/jsmacos.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef jsmacos_h___
|
||||
#define jsmacos_h___
|
||||
//
|
||||
// This file contains all changes and additions that need to be made to the
|
||||
// runtime for the Macintosh platform hosting the Metrowerks environment.
|
||||
// This file should only be included in Macintosh builds.
|
||||
//
|
||||
|
||||
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 /* jsmacos_h___ */
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsdtoa.h"
|
||||
#include "jsprf.h"
|
||||
@@ -182,7 +183,7 @@ num_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
d = JSVAL_IS_INT(v) ? (jsdouble)JSVAL_TO_INT(v) : *JSVAL_TO_DOUBLE(v);
|
||||
i = JS_snprintf(buf, sizeof buf, "(new %s(", number_class.name);
|
||||
|
||||
JS_cnvtf(buf + i, sizeof buf - i, 20, d);
|
||||
PR_cnvtf(buf + i, sizeof buf - i, 20, d);
|
||||
i = strlen(buf);
|
||||
JS_snprintf(buf + i, sizeof buf - i, "))");
|
||||
str = JS_NewStringCopyZ(cx, buf);
|
||||
@@ -432,7 +433,7 @@ js_NumberToString(JSContext *cx, jsdouble d)
|
||||
if (JSDOUBLE_IS_INT(d, i)) {
|
||||
JS_snprintf(buf, sizeof buf, "%ld", (long)i);
|
||||
} else {
|
||||
JS_cnvtf(buf, sizeof buf, 20, d);
|
||||
PR_cnvtf(buf, sizeof buf, 20, d);
|
||||
}
|
||||
return JS_NewStringCopyZ(cx, buf);
|
||||
}
|
||||
@@ -647,7 +648,7 @@ js_strtod(JSContext *cx, const jschar *s, const jschar **ep, jsdouble *dp)
|
||||
estr = istr + 8;
|
||||
} else {
|
||||
errno = 0;
|
||||
d = JS_strtod(cstr, &estr);
|
||||
d = PR_strtod(cstr, &estr);
|
||||
if (errno == ERANGE)
|
||||
if (d == HUGE_VAL)
|
||||
d = *cx->runtime->jsPositiveInfinity;
|
||||
@@ -757,7 +758,7 @@ js_strtointeger(JSContext *cx, const jschar *s, const jschar **ep, jsint base, j
|
||||
if (base == 10) {
|
||||
/* If we're accumulating a decimal number and the number is >= 2^53, then
|
||||
* the result from the repeated multiply-add above may be inaccurate. Call
|
||||
* JS_strtod to get the correct answer.
|
||||
* PR_strtod to get the correct answer.
|
||||
*/
|
||||
size_t i;
|
||||
size_t length = s1 - start;
|
||||
@@ -771,7 +772,7 @@ js_strtointeger(JSContext *cx, const jschar *s, const jschar **ep, jsint base, j
|
||||
cstr[length] = 0;
|
||||
|
||||
errno = 0;
|
||||
value = JS_strtod(cstr, &estr);
|
||||
value = PR_strtod(cstr, &estr);
|
||||
if (errno == ERANGE && value == HUGE_VAL)
|
||||
value = *cx->runtime->jsPositiveInfinity;
|
||||
free(cstr);
|
||||
|
||||
@@ -23,9 +23,22 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
#ifndef NSPR20
|
||||
#include "jsarena.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "plarena.h"
|
||||
*/
|
||||
#include "jsarena.h" /* Added by JSIFY */
|
||||
#endif
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#ifndef NSPR20
|
||||
#include "jshash.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "JShash.h"
|
||||
*/
|
||||
#include "jshash.h" /* Added by JSIFY */
|
||||
#endif
|
||||
#include "jsprf.h"
|
||||
#include "jsapi.h"
|
||||
#include "jsatom.h"
|
||||
@@ -91,7 +104,7 @@ JSClass js_ObjectClass = {
|
||||
static JSBool
|
||||
obj_getSlot(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(JSBool)
|
||||
STATIC_DLL_CALLBACK(JSBool)
|
||||
obj_setSlot(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
|
||||
|
||||
static JSBool
|
||||
@@ -126,7 +139,7 @@ obj_getSlot(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(JSBool)
|
||||
STATIC_DLL_CALLBACK(JSBool)
|
||||
obj_setSlot(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
JSObject *obj2;
|
||||
@@ -178,7 +191,7 @@ error:
|
||||
|
||||
#endif /* !JS_HAS_OBJ_PROTO_PROP */
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(JSHashNumber)
|
||||
STATIC_DLL_CALLBACK(JSHashNumber)
|
||||
js_hash_object(const void *key)
|
||||
{
|
||||
return (JSHashNumber)key >> JSVAL_TAGBITS;
|
||||
@@ -595,13 +608,6 @@ obj_eval(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
|
||||
caller = cx->fp->down;
|
||||
|
||||
if ((cx->version == JSVERSION_DEFAULT || cx->version >= JSVERSION_1_4)
|
||||
&& (*caller->pc != JSOP_CALLSPECIAL)) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_BAD_INDIRECT_CALL, js_eval_str);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
#if JS_HAS_SCRIPT_OBJECT
|
||||
/*
|
||||
* Script.prototype.compile/exec and Object.prototype.eval all take an
|
||||
@@ -1056,11 +1062,6 @@ js_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent)
|
||||
obj->slots[JSSLOT_CLASS] = PRIVATE_TO_JSVAL(clasp);
|
||||
for (i = JSSLOT_CLASS+1; i < JS_INITIAL_NSLOTS; i++)
|
||||
obj->slots[i] = JSVAL_VOID;
|
||||
|
||||
if (cx->runtime->objectHook) {
|
||||
cx->runtime->objectHook(cx, obj, JS_TRUE, cx->runtime->objectHookData);
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
||||
bad:
|
||||
@@ -1176,10 +1177,6 @@ js_FinalizeObject(JSContext *cx, JSObject *obj)
|
||||
if (!map)
|
||||
return;
|
||||
|
||||
if (cx->runtime->objectHook) {
|
||||
cx->runtime->objectHook(cx, obj, JS_FALSE, cx->runtime->objectHookData);
|
||||
}
|
||||
|
||||
#if JS_HAS_OBJ_WATCHPOINT
|
||||
/* Remove all watchpoints with weak links to obj. */
|
||||
JS_ClearWatchPointsForObject(cx, obj);
|
||||
@@ -2024,14 +2021,7 @@ js_DefaultValue(JSContext *cx, JSObject *obj, JSType hint, jsval *vp)
|
||||
v = OBJECT_TO_JSVAL(obj);
|
||||
switch (hint) {
|
||||
case JSTYPE_STRING:
|
||||
/*
|
||||
* Propagate the exception if js_TryMethod finds an appropriate
|
||||
* method, and calling that method returned failure.
|
||||
*/
|
||||
if (!js_TryMethod(cx, obj, cx->runtime->atomState.toStringAtom, 0, NULL,
|
||||
&v))
|
||||
return JS_FALSE;
|
||||
|
||||
js_TryMethod(cx, obj, cx->runtime->atomState.toStringAtom, 0, NULL, &v);
|
||||
if (!JSVAL_IS_PRIMITIVE(v)) {
|
||||
if (!OBJ_GET_CLASS(cx, obj)->convert(cx, obj, hint, &v))
|
||||
return JS_FALSE;
|
||||
@@ -2066,9 +2056,8 @@ js_DefaultValue(JSContext *cx, JSObject *obj, JSType hint, jsval *vp)
|
||||
/* Don't convert to string (source object literal) for JS1.2. */
|
||||
if (cx->version == JSVERSION_1_2 && hint == JSTYPE_BOOLEAN)
|
||||
goto out;
|
||||
if (!js_TryMethod(cx, obj, cx->runtime->atomState.toStringAtom, 0,
|
||||
NULL, &v))
|
||||
return JS_FALSE;
|
||||
js_TryMethod(cx, obj, cx->runtime->atomState.toStringAtom, 0, NULL,
|
||||
&v);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2424,45 +2413,33 @@ js_ValueToNonNullObject(JSContext *cx, jsval v)
|
||||
return obj;
|
||||
}
|
||||
|
||||
JSBool
|
||||
void
|
||||
js_TryValueOf(JSContext *cx, JSObject *obj, JSType type, jsval *rval)
|
||||
{
|
||||
#if JS_HAS_VALUEOF_HINT
|
||||
jsval argv[1];
|
||||
|
||||
argv[0] = ATOM_KEY(cx->runtime->atomState.typeAtoms[type]);
|
||||
return js_TryMethod(cx, obj, cx->runtime->atomState.valueOfAtom, 1, argv,
|
||||
rval);
|
||||
js_TryMethod(cx, obj, cx->runtime->atomState.valueOfAtom, 1, argv, rval);
|
||||
#else
|
||||
return js_TryMethod(cx, obj, cx->runtime->atomState.valueOfAtom, 0, NULL,
|
||||
rval);
|
||||
js_TryMethod(cx, obj, cx->runtime->atomState.valueOfAtom, 0, NULL, rval);
|
||||
#endif
|
||||
}
|
||||
|
||||
JSBool
|
||||
void
|
||||
js_TryMethod(JSContext *cx, JSObject *obj, JSAtom *atom,
|
||||
uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
JSErrorReporter older;
|
||||
jsval fval;
|
||||
JSBool ok;
|
||||
|
||||
/*
|
||||
* Report failure only if an appropriate method was found, and calling it
|
||||
* returned failure. We propagate failure in this case to make exceptions
|
||||
* behave properly.
|
||||
*/
|
||||
|
||||
older = JS_SetErrorReporter(cx, NULL);
|
||||
if (OBJ_GET_PROPERTY(cx, obj, (jsid)atom, &fval) &&
|
||||
JSVAL_IS_OBJECT(fval) &&
|
||||
fval != JSVAL_NULL) {
|
||||
ok = js_CallFunctionValue(cx, obj, fval, argc, argv, rval);
|
||||
} else {
|
||||
ok = JS_TRUE;
|
||||
(void) js_CallFunctionValue(cx, obj, fval, argc, argv, rval);
|
||||
}
|
||||
JS_SetErrorReporter(cx, older);
|
||||
return ok;
|
||||
}
|
||||
|
||||
#if JS_HAS_XDR
|
||||
|
||||
@@ -26,7 +26,15 @@
|
||||
* values, called slots. The map/slot pointer pair is GC'ed, while the map
|
||||
* is reference counted and the slot vector is malloc'ed.
|
||||
*/
|
||||
#ifdef NETSCAPE_INTERNAL
|
||||
#ifndef NSPR20
|
||||
#include "jshash.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "JShash.h"
|
||||
*/
|
||||
#include "jshash.h" /* Added by JSIFY */
|
||||
#endif
|
||||
#endif
|
||||
#include "jsprvtd.h"
|
||||
#include "jspubtd.h"
|
||||
|
||||
@@ -309,10 +317,10 @@ js_ValueToObject(JSContext *cx, jsval v, JSObject **objp);
|
||||
extern JSObject *
|
||||
js_ValueToNonNullObject(JSContext *cx, jsval v);
|
||||
|
||||
extern JSBool
|
||||
extern void
|
||||
js_TryValueOf(JSContext *cx, JSObject *obj, JSType type, jsval *rval);
|
||||
|
||||
extern JSBool
|
||||
extern void
|
||||
js_TryMethod(JSContext *cx, JSObject *obj, JSAtom *atom,
|
||||
uintN argc, jsval *argv, jsval *rval);
|
||||
|
||||
|
||||
@@ -26,7 +26,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
#ifndef NSPR20
|
||||
#include "jsarena.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "plarena.h"
|
||||
*/
|
||||
#include "jsarena.h" /* Added by JSIFY */
|
||||
#endif
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsdtoa.h"
|
||||
#include "jsprf.h"
|
||||
@@ -1552,7 +1559,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
|
||||
todo = Sprint(&ss->sprinter, "%ld", ival);
|
||||
} else if (JSVAL_IS_DOUBLE(key)) {
|
||||
char buf[32];
|
||||
JS_cnvtf(buf, sizeof buf, 20, *JSVAL_TO_DOUBLE(key));
|
||||
PR_cnvtf(buf, sizeof buf, 20, *JSVAL_TO_DOUBLE(key));
|
||||
todo = Sprint(&ss->sprinter, buf);
|
||||
} else if (JSVAL_IS_STRING(key)) {
|
||||
rval = QuoteString(&ss->sprinter, ATOM_TO_STRING(atom),
|
||||
@@ -1995,26 +2002,6 @@ js_DecompileScript(JSPrinter *jp, JSScript *script)
|
||||
return js_DecompileCode(jp, script, script->code, (uintN)script->length);
|
||||
}
|
||||
|
||||
JSBool
|
||||
js_DecompileFunctionBody(JSPrinter *jp, JSFunction *fun, JSBool newlines)
|
||||
{
|
||||
JSScript *script = fun->script;
|
||||
if (script) {
|
||||
JSScope *oldScope, *scope = NULL;
|
||||
JSBool ok;
|
||||
if (fun->object) scope = (JSScope *)fun->object->map;
|
||||
oldScope = jp->scope;
|
||||
jp->scope = scope;
|
||||
ok = js_DecompileCode(jp, script, script->code, (uintN)script->length);
|
||||
jp->scope = oldScope;
|
||||
return ok;
|
||||
}
|
||||
else {
|
||||
js_printf(jp, "\t[native code]\n");
|
||||
return JS_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
JSBool
|
||||
js_DecompileFunction(JSPrinter *jp, JSFunction *fun, JSBool newlines)
|
||||
{
|
||||
@@ -2147,12 +2134,7 @@ js_DecompileValueGenerator(JSContext *cx, jsval v, JSString *fallback)
|
||||
/* Be paranoid about loading an invalid pc from sp[-depth]. */
|
||||
if (!pc)
|
||||
goto do_fallback;
|
||||
|
||||
/*
|
||||
* Using an object for which js_DefaultValue fails as part of an expression
|
||||
* blows this assert. Disabled for now.
|
||||
* JS_ASSERT(JS_UPTRDIFF(pc, script->code) < (jsuword)script->length);
|
||||
*/
|
||||
JS_ASSERT(JS_UPTRDIFF(pc, script->code) < (jsuword)script->length);
|
||||
if (JS_UPTRDIFF(pc, script->code) >= (jsuword)script->length) {
|
||||
pc = fp->pc;
|
||||
if (!pc)
|
||||
|
||||
@@ -172,9 +172,6 @@ js_DecompileCode(JSPrinter *jp, JSScript *script, jsbytecode *pc, uintN len);
|
||||
extern JSBool
|
||||
js_DecompileScript(JSPrinter *jp, JSScript *script);
|
||||
|
||||
extern JSBool
|
||||
js_DecompileFunctionBody(JSPrinter *jp, JSFunction *fun, JSBool newlines);
|
||||
|
||||
extern JSBool
|
||||
js_DecompileFunction(JSPrinter *jp, JSFunction *fun, JSBool newlines);
|
||||
|
||||
|
||||
@@ -210,8 +210,3 @@ OPDEF(JSOP_SETSP, 117,"setsp", NULL, 3, 0, 0, 0, JOF_UINT16
|
||||
OPDEF(JSOP_CONDSWITCH,118,"condswitch", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_CASE, 119,"case", NULL, 3, 1, 0, 0, JOF_JUMP)
|
||||
OPDEF(JSOP_DEFAULT, 120,"default", NULL, 3, 1, 0, 0, JOF_JUMP)
|
||||
|
||||
/*
|
||||
* ECMA-compliant call to eval op
|
||||
*/
|
||||
OPDEF(JSOP_CALLSPECIAL,121,"callspecial",NULL, 3, -1, 1, 11, JOF_UINT16)
|
||||
|
||||
@@ -25,25 +25,15 @@
|
||||
#ifdef XP_PC
|
||||
|
||||
#ifdef _WIN32
|
||||
#define HAVE_LONG_LONG
|
||||
#include "os/win32.h"
|
||||
#else
|
||||
#undef HAVE_LONG_LONG
|
||||
#include "os/win16.h"
|
||||
#endif
|
||||
#endif /* XP_PC */
|
||||
|
||||
#ifdef XP_MAC
|
||||
|
||||
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 */
|
||||
#include "jsmacos.h"
|
||||
#endif
|
||||
|
||||
#ifdef XP_UNIX
|
||||
|
||||
@@ -51,40 +41,34 @@ JS_END_EXTERN_C
|
||||
* Get OS specific header information.
|
||||
*/
|
||||
#if defined(AIXV3)
|
||||
#define HAVE_LONG_LONG
|
||||
#include "os/aix.h"
|
||||
|
||||
#elif defined(BSDI)
|
||||
#define HAVE_LONG_LONG
|
||||
#include "os/bsdi.h"
|
||||
|
||||
#elif defined(HPUX)
|
||||
#undef HAVE_LONG_LONG
|
||||
#include "os/hpux.h"
|
||||
|
||||
#elif defined(IRIX)
|
||||
#define HAVE_LONG_LONG
|
||||
#include "os/irix.h"
|
||||
|
||||
#elif defined(linux)
|
||||
#undef HAVE_LONG_LONG
|
||||
#elif defined(LINUX)
|
||||
#include "os/linux.h"
|
||||
|
||||
#elif defined(OSF1)
|
||||
#define HAVE_LONG_LONG
|
||||
#include "os/osf1.h"
|
||||
|
||||
#elif defined(SCO)
|
||||
#undef HAVE_LONG_LONG
|
||||
#include "os/scoos.h"
|
||||
|
||||
#elif defined(SOLARIS)
|
||||
#define HAVE_LONG_LONG
|
||||
#include "os/solaris.h"
|
||||
|
||||
#elif defined(SUNOS4)
|
||||
#undef HAVE_LONG_LONG
|
||||
|
||||
/*
|
||||
** Missing function prototypes
|
||||
*/
|
||||
|
||||
extern void *sbrk(int);
|
||||
#include "os/sunos.h"
|
||||
|
||||
#elif defined(UNIXWARE)
|
||||
#undef HAVE_LONG_LONG
|
||||
#include "os/unixware.h"
|
||||
#endif
|
||||
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
@@ -23,18 +23,11 @@
|
||||
* the new definitions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Note that we test for PROTYPES_H, not JSOTYPES_H. This is to avoid
|
||||
* double-definitions of scalar types such as uint32, if NSPR's
|
||||
* protypes.h is also included.
|
||||
*/
|
||||
#ifndef PROTYPES_H
|
||||
#define PROTYPES_H
|
||||
|
||||
/* SVR4 typedef of uint is commonly found on UNIX machines. */
|
||||
#ifdef XP_UNIX
|
||||
#include <sys/types.h>
|
||||
#else
|
||||
#ifndef XP_UNIX
|
||||
typedef JSUintn uint;
|
||||
#endif
|
||||
|
||||
@@ -86,84 +79,6 @@ typedef JSFloat64 float64;
|
||||
#define SET_BIT JS_SET_BIT
|
||||
#define CLEAR_BIT JS_CLEAR_BIT
|
||||
|
||||
/* Re: prarena.h->plarena.h */
|
||||
#define PRArena PLArena
|
||||
#define PRArenaPool PLArenaPool
|
||||
#define PRArenaStats PLArenaStats
|
||||
#define PR_ARENA_ALIGN PL_ARENA_ALIGN
|
||||
#define PR_INIT_ARENA_POOL PL_INIT_ARENA_POOL
|
||||
#define PR_ARENA_ALLOCATE PL_ARENA_ALLOCATE
|
||||
#define PR_ARENA_GROW PL_ARENA_GROW
|
||||
#define PR_ARENA_MARK PL_ARENA_MARK
|
||||
#define PR_CLEAR_UNUSED PL_CLEAR_UNUSED
|
||||
#define PR_CLEAR_ARENA PL_CLEAR_ARENA
|
||||
#define PR_ARENA_RELEASE PL_ARENA_RELEASE
|
||||
#define PR_COUNT_ARENA PL_COUNT_ARENA
|
||||
#define PR_ARENA_DESTROY PL_ARENA_DESTROY
|
||||
#define PR_InitArenaPool PL_InitArenaPool
|
||||
#define PR_FreeArenaPool PL_FreeArenaPool
|
||||
#define PR_FinishArenaPool PL_FinishArenaPool
|
||||
#define PR_CompactArenaPool PL_CompactArenaPool
|
||||
#define PR_ArenaFinish PL_ArenaFinish
|
||||
#define PR_ArenaAllocate PL_ArenaAllocate
|
||||
#define PR_ArenaGrow PL_ArenaGrow
|
||||
#define PR_ArenaRelease PL_ArenaRelease
|
||||
#define PR_ArenaCountAllocation PL_ArenaCountAllocation
|
||||
#define PR_ArenaCountInplaceGrowth PL_ArenaCountInplaceGrowth
|
||||
#define PR_ArenaCountGrowth PL_ArenaCountGrowth
|
||||
#define PR_ArenaCountRelease PL_ArenaCountRelease
|
||||
#define PR_ArenaCountRetract PL_ArenaCountRetract
|
||||
|
||||
/* Re: prevent.h->plevent.h */
|
||||
#define PREvent PLEvent
|
||||
#define PREventQueue PLEventQueue
|
||||
#define PR_CreateEventQueue PL_CreateEventQueue
|
||||
#define PR_DestroyEventQueue PL_DestroyEventQueue
|
||||
#define PR_GetEventQueueMonitor PL_GetEventQueueMonitor
|
||||
#define PR_ENTER_EVENT_QUEUE_MONITOR PL_ENTER_EVENT_QUEUE_MONITOR
|
||||
#define PR_EXIT_EVENT_QUEUE_MONITOR PL_EXIT_EVENT_QUEUE_MONITOR
|
||||
#define PR_PostEvent PL_PostEvent
|
||||
#define PR_PostSynchronousEvent PL_PostSynchronousEvent
|
||||
#define PR_GetEvent PL_GetEvent
|
||||
#define PR_EventAvailable PL_EventAvailable
|
||||
#define PREventFunProc PLEventFunProc
|
||||
#define PR_MapEvents PL_MapEvents
|
||||
#define PR_RevokeEvents PL_RevokeEvents
|
||||
#define PR_ProcessPendingEvents PL_ProcessPendingEvents
|
||||
#define PR_WaitForEvent PL_WaitForEvent
|
||||
#define PR_EventLoop PL_EventLoop
|
||||
#define PR_GetEventQueueSelectFD PL_GetEventQueueSelectFD
|
||||
#define PRHandleEventProc PLHandleEventProc
|
||||
#define PRDestroyEventProc PLDestroyEventProc
|
||||
#define PR_InitEvent PL_InitEvent
|
||||
#define PR_GetEventOwner PL_GetEventOwner
|
||||
#define PR_HandleEvent PL_HandleEvent
|
||||
#define PR_DestroyEvent PL_DestroyEvent
|
||||
#define PR_DequeueEvent PL_DequeueEvent
|
||||
#define PR_GetMainEventQueue PL_GetMainEventQueue
|
||||
|
||||
/* Re: prhash.h->plhash.h */
|
||||
#define PRHashEntry PLHashEntry
|
||||
#define PRHashTable PLHashTable
|
||||
#define PRHashNumber PLHashNumber
|
||||
#define PRHashFunction PLHashFunction
|
||||
#define PRHashComparator PLHashComparator
|
||||
#define PRHashEnumerator PLHashEnumerator
|
||||
#define PRHashAllocOps PLHashAllocOps
|
||||
#define PR_NewHashTable PL_NewHashTable
|
||||
#define PR_HashTableDestroy PL_HashTableDestroy
|
||||
#define PR_HashTableRawLookup PL_HashTableRawLookup
|
||||
#define PR_HashTableRawAdd PL_HashTableRawAdd
|
||||
#define PR_HashTableRawRemove PL_HashTableRawRemove
|
||||
#define PR_HashTableAdd PL_HashTableAdd
|
||||
#define PR_HashTableRemove PL_HashTableRemove
|
||||
#define PR_HashTableEnumerateEntries PL_HashTableEnumerateEntries
|
||||
#define PR_HashTableLookup PL_HashTableLookup
|
||||
#define PR_HashTableDump PL_HashTableDump
|
||||
#define PR_HashString PL_HashString
|
||||
#define PR_CompareStrings PL_CompareStrings
|
||||
#define PR_CompareValues PL_CompareValues
|
||||
|
||||
#ifdef XP_MAC
|
||||
#ifndef TRUE /* Mac standard is lower case true */
|
||||
#define TRUE 1
|
||||
|
||||
@@ -36,7 +36,14 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "jstypes.h"
|
||||
#ifndef NSPR20
|
||||
#include "jsarena.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "plarena.h"
|
||||
*/
|
||||
#include "jsarena.h" /* Added by JSIFY */
|
||||
#endif
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsapi.h"
|
||||
#include "jsatom.h"
|
||||
@@ -378,7 +385,7 @@ js_CompileFunctionBody(JSContext *cx, JSTokenStream *ts, JSFunction *fun)
|
||||
}
|
||||
|
||||
cx->gcDisabled--;
|
||||
js_FinishCodeGenerator(cx, &funcg);
|
||||
js_ResetCodeGenerator(cx, &funcg);
|
||||
return ok;
|
||||
}
|
||||
|
||||
@@ -1141,6 +1148,11 @@ Statement(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
* catch (v)
|
||||
* catch (v : <boolean_expression>)
|
||||
*/
|
||||
if (!catchtail->pn_kid1->pn_expr) {
|
||||
js_ReportCompileErrorNumber(cx, ts, JSREPORT_WARNING,
|
||||
JSMSG_CATCH_AFTER_GENERAL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* catch node */
|
||||
pn2 = NewParseNode(cx, &ts->token, PN_TERNARY);
|
||||
@@ -1477,7 +1489,7 @@ Variables(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
JSObject *obj, *pobj;
|
||||
JSFunction *fun;
|
||||
JSClass *clasp;
|
||||
JSPropertyOp getter, setter, currentGetter, currentSetter;
|
||||
JSPropertyOp getter, setter;
|
||||
JSAtom *atom;
|
||||
JSProperty *prop;
|
||||
JSScopeProperty *sprop;
|
||||
@@ -1519,8 +1531,6 @@ Variables(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
}
|
||||
|
||||
do {
|
||||
currentGetter = getter;
|
||||
currentSetter = setter;
|
||||
MUST_MATCH_TOKEN(TOK_NAME, JSMSG_NO_VARIABLE_NAME);
|
||||
atom = ts->token.t_atom;
|
||||
|
||||
@@ -1539,7 +1549,7 @@ Variables(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
OBJ_IS_NATIVE(pobj) &&
|
||||
(sprop = (JSScopeProperty *)prop) != NULL) {
|
||||
if (sprop->getter == js_GetArgument) {
|
||||
currentGetter = sprop->getter;
|
||||
getter = sprop->getter;
|
||||
#ifdef CHECK_ARGUMENT_HIDING
|
||||
js_ReportCompileErrorNumber(cx, ts, JSREPORT_WARNING,
|
||||
JSMSG_VAR_HIDES_ARG,
|
||||
@@ -1571,16 +1581,16 @@ Variables(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
* don't use the special getters and setters
|
||||
* since we can't allocate a slot in the frame.
|
||||
*/
|
||||
currentGetter = sprop->getter;
|
||||
currentSetter = sprop->setter;
|
||||
getter = sprop->getter;
|
||||
setter = sprop->setter;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Global var: (re-)set id a la js_DefineProperty. */
|
||||
sprop->id = ATOM_KEY(atom);
|
||||
}
|
||||
sprop->getter = currentGetter;
|
||||
sprop->setter = currentSetter;
|
||||
sprop->getter = getter;
|
||||
sprop->setter = setter;
|
||||
sprop->attrs |= JSPROP_ENUMERATE | JSPROP_PERMANENT;
|
||||
sprop->attrs &= ~JSPROP_READONLY;
|
||||
}
|
||||
@@ -1596,18 +1606,18 @@ Variables(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
OBJ_DROP_PROPERTY(cx, pobj, prop);
|
||||
prop = NULL;
|
||||
}
|
||||
if (currentGetter == js_GetCallVariable) {
|
||||
if (getter == js_GetCallVariable) {
|
||||
/* Can't increase fun->nvars in an active frame! */
|
||||
currentGetter = clasp->getProperty;
|
||||
currentSetter = clasp->setProperty;
|
||||
getter = clasp->getProperty;
|
||||
setter = clasp->setProperty;
|
||||
}
|
||||
ok = OBJ_DEFINE_PROPERTY(cx, obj, (jsid)atom, JSVAL_VOID,
|
||||
currentGetter, currentSetter,
|
||||
getter, setter,
|
||||
JSPROP_ENUMERATE | JSPROP_PERMANENT,
|
||||
&prop);
|
||||
if (ok && prop) {
|
||||
pobj = obj;
|
||||
if (currentGetter == js_GetLocalVariable) {
|
||||
if (getter == js_GetLocalVariable) {
|
||||
/*
|
||||
* Allocate more room for variables in the
|
||||
* function's frame. We can do this only
|
||||
@@ -1640,14 +1650,14 @@ Variables(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
/* Depending on the value of the getter, change the
|
||||
* opcodes to the forms for arguments and variables.
|
||||
*/
|
||||
if (currentGetter == js_GetArgument) {
|
||||
if (getter == js_GetArgument) {
|
||||
JS_ASSERT(sprop && JSVAL_IS_INT(sprop->id));
|
||||
pn2->pn_op = (pn2->pn_op == JSOP_NAME)
|
||||
? JSOP_GETARG
|
||||
: JSOP_SETARG;
|
||||
pn2->pn_slot = JSVAL_TO_INT(sprop->id);
|
||||
} else if (currentGetter == js_GetLocalVariable ||
|
||||
currentGetter == js_GetCallVariable)
|
||||
} else if (getter == js_GetLocalVariable ||
|
||||
getter == js_GetCallVariable)
|
||||
{
|
||||
JS_ASSERT(sprop && JSVAL_IS_INT(sprop->id));
|
||||
pn2->pn_op = (pn2->pn_op == JSOP_NAME)
|
||||
|
||||
@@ -28,7 +28,10 @@
|
||||
#include <stdlib.h>
|
||||
#include "jsprf.h"
|
||||
#include "jslong.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
/* Removed by JSIFY: #include "jsmem.h"
|
||||
*/
|
||||
|
||||
/*
|
||||
** Note: on some platforms va_list is defined as an array,
|
||||
@@ -1020,7 +1023,7 @@ static int FuncStuff(SprintfState *ss, const char *sp, JSUint32 len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(JSUint32) JS_sxprintf(JSStuffFunc func, void *arg,
|
||||
IMPLEMENT(JSUint32) JS_sxprintf(JSStuffFunc func, void *arg,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -1032,7 +1035,7 @@ JS_EXPORT_API(JSUint32) JS_sxprintf(JSStuffFunc func, void *arg,
|
||||
return rv;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(JSUint32) JS_vsxprintf(JSStuffFunc func, void *arg,
|
||||
IMPLEMENT(JSUint32) JS_vsxprintf(JSStuffFunc func, void *arg,
|
||||
const char *fmt, va_list ap)
|
||||
{
|
||||
SprintfState ss;
|
||||
@@ -1086,7 +1089,7 @@ static int GrowStuff(SprintfState *ss, const char *sp, JSUint32 len)
|
||||
/*
|
||||
** sprintf into a malloc'd buffer
|
||||
*/
|
||||
JS_EXPORT_API(char *) JS_smprintf(const char *fmt, ...)
|
||||
IMPLEMENT(char *) JS_smprintf(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *rv;
|
||||
@@ -1100,12 +1103,12 @@ JS_EXPORT_API(char *) JS_smprintf(const char *fmt, ...)
|
||||
/*
|
||||
** Free memory allocated, for the caller, by JS_smprintf
|
||||
*/
|
||||
JS_EXPORT_API(void) JS_smprintf_free(char *mem)
|
||||
IMPLEMENT(void) JS_smprintf_free(char *mem)
|
||||
{
|
||||
JS_DELETE(mem);
|
||||
}
|
||||
|
||||
JS_EXPORT_API(char *) JS_vsmprintf(const char *fmt, va_list ap)
|
||||
IMPLEMENT(char *) JS_vsmprintf(const char *fmt, va_list ap)
|
||||
{
|
||||
SprintfState ss;
|
||||
int rv;
|
||||
@@ -1145,7 +1148,7 @@ static int LimitStuff(SprintfState *ss, const char *sp, JSUint32 len)
|
||||
** sprintf into a fixed size buffer. Make sure there is a NUL at the end
|
||||
** when finished.
|
||||
*/
|
||||
JS_EXPORT_API(JSUint32) JS_snprintf(char *out, JSUint32 outlen, const char *fmt, ...)
|
||||
IMPLEMENT(JSUint32) JS_snprintf(char *out, JSUint32 outlen, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int rv;
|
||||
@@ -1161,7 +1164,7 @@ JS_EXPORT_API(JSUint32) JS_snprintf(char *out, JSUint32 outlen, const char *fmt,
|
||||
return rv;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(JSUint32) JS_vsnprintf(char *out, JSUint32 outlen,const char *fmt,
|
||||
IMPLEMENT(JSUint32) JS_vsnprintf(char *out, JSUint32 outlen,const char *fmt,
|
||||
va_list ap)
|
||||
{
|
||||
SprintfState ss;
|
||||
@@ -1186,7 +1189,7 @@ JS_EXPORT_API(JSUint32) JS_vsnprintf(char *out, JSUint32 outlen,const char *fmt,
|
||||
return n ? n - 1 : n;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(char *) JS_sprintf_append(char *last, const char *fmt, ...)
|
||||
IMPLEMENT(char *) JS_sprintf_append(char *last, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *rv;
|
||||
@@ -1197,7 +1200,7 @@ JS_EXPORT_API(char *) JS_sprintf_append(char *last, const char *fmt, ...)
|
||||
return rv;
|
||||
}
|
||||
|
||||
JS_EXPORT_API(char *) JS_vsprintf_append(char *last, const char *fmt, va_list ap)
|
||||
IMPLEMENT(char *) JS_vsprintf_append(char *last, const char *fmt, va_list ap)
|
||||
{
|
||||
SprintfState ss;
|
||||
int rv;
|
||||
|
||||
@@ -46,19 +46,19 @@ JS_BEGIN_EXTERN_C
|
||||
** of the buffer. Returns the length of the written output, NOT including
|
||||
** the NUL, or (JSUint32)-1 if an error occurs.
|
||||
*/
|
||||
JS_EXTERN_API(JSUint32) JS_snprintf(char *out, JSUint32 outlen, const char *fmt, ...);
|
||||
EXTERN(JSUint32) JS_snprintf(char *out, JSUint32 outlen, const char *fmt, ...);
|
||||
|
||||
/*
|
||||
** sprintf into a malloc'd buffer. Return a pointer to the malloc'd
|
||||
** buffer on success, NULL on failure. Call "JS_smprintf_free" to release
|
||||
** the memory returned.
|
||||
*/
|
||||
JS_EXTERN_API(char*) JS_smprintf(const char *fmt, ...);
|
||||
EXTERN(char*) JS_smprintf(const char *fmt, ...);
|
||||
|
||||
/*
|
||||
** Free the memory allocated, for the caller, by JS_smprintf
|
||||
*/
|
||||
JS_EXTERN_API(void) JS_smprintf_free(char *mem);
|
||||
EXTERN(void) JS_smprintf_free(char *mem);
|
||||
|
||||
/*
|
||||
** "append" sprintf into a malloc'd buffer. "last" is the last value of
|
||||
@@ -67,7 +67,7 @@ JS_EXTERN_API(void) JS_smprintf_free(char *mem);
|
||||
** will allocate the initial string. The return value is the new value of
|
||||
** last for subsequent calls, or NULL if there is a malloc failure.
|
||||
*/
|
||||
JS_EXTERN_API(char*) JS_sprintf_append(char *last, const char *fmt, ...);
|
||||
EXTERN(char*) JS_sprintf_append(char *last, const char *fmt, ...);
|
||||
|
||||
/*
|
||||
** sprintf into a function. The function "f" is called with a string to
|
||||
@@ -78,15 +78,15 @@ JS_EXTERN_API(char*) JS_sprintf_append(char *last, const char *fmt, ...);
|
||||
*/
|
||||
typedef JSIntn (*JSStuffFunc)(void *arg, const char *s, JSUint32 slen);
|
||||
|
||||
JS_EXTERN_API(JSUint32) JS_sxprintf(JSStuffFunc f, void *arg, const char *fmt, ...);
|
||||
EXTERN(JSUint32) JS_sxprintf(JSStuffFunc f, void *arg, const char *fmt, ...);
|
||||
|
||||
/*
|
||||
** va_list forms of the above.
|
||||
*/
|
||||
JS_EXTERN_API(JSUint32) JS_vsnprintf(char *out, JSUint32 outlen, const char *fmt, va_list ap);
|
||||
JS_EXTERN_API(char*) JS_vsmprintf(const char *fmt, va_list ap);
|
||||
JS_EXTERN_API(char*) JS_vsprintf_append(char *last, const char *fmt, va_list ap);
|
||||
JS_EXTERN_API(JSUint32) JS_vsxprintf(JSStuffFunc f, void *arg, const char *fmt, va_list ap);
|
||||
EXTERN(JSUint32) JS_vsnprintf(char *out, JSUint32 outlen, const char *fmt, va_list ap);
|
||||
EXTERN(char*) JS_vsmprintf(const char *fmt, va_list ap);
|
||||
EXTERN(char*) JS_vsprintf_append(char *last, const char *fmt, va_list ap);
|
||||
EXTERN(JSUint32) JS_vsxprintf(JSStuffFunc f, void *arg, const char *fmt, va_list ap);
|
||||
|
||||
/*
|
||||
***************************************************************************
|
||||
@@ -121,7 +121,7 @@ JS_EXTERN_API(JSUint32) JS_vsxprintf(JSStuffFunc f, void *arg, const char *fmt,
|
||||
***************************************************************************
|
||||
*/
|
||||
|
||||
JS_EXTERN_API(JSInt32) JS_sscanf(const char *buf, const char *fmt, ...);
|
||||
EXTERN(JSInt32) JS_sscanf(const char *buf, const char *fmt, ...);
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ typedef struct JSPRHashEntry JSPRHashEntry;
|
||||
typedef struct JSPRHashTable JSPRHashTable;
|
||||
typedef JSPRUint32 JSPRHashNumber;
|
||||
#define JSPR_HASH_BITS 32
|
||||
typedef JSPRHashNumber (JSJS_DLL_CALLBACK *JSPRHashFunction)(const void *key);
|
||||
typedef JSPRIntn (JSJS_DLL_CALLBACK *JSPRHashComparator)(const void *v1, const void *v2);
|
||||
typedef JSPRIntn (JSJS_DLL_CALLBACK *JSPRHashEnumerator)(JSPRHashEntry *he, JSPRIntn i, void *arg);
|
||||
typedef JSPRHashNumber (JSCALLBACK *JSPRHashFunction)(const void *key);
|
||||
typedef JSPRIntn (JSCALLBACK *JSPRHashComparator)(const void *v1, const void *v2);
|
||||
typedef JSPRIntn (JSCALLBACK *JSPRHashEnumerator)(JSPRHashEntry *he, JSPRIntn i, void *arg);
|
||||
|
||||
/* Flag bits in JSPRHashEnumerator's return value */
|
||||
#define HT_ENUMERATE_NEXT 0 /* continue enumerating entries */
|
||||
@@ -42,10 +42,10 @@ typedef JSPRIntn (JSJS_DLL_CALLBACK *JSPRHashEnumerator)(JSPRHashEntry *he, JSPR
|
||||
#define HT_ENUMERATE_UNHASH 4 /* just unhash the current entry */
|
||||
|
||||
typedef struct JSPRHashAllocOps {
|
||||
void * (JSJS_DLL_CALLBACK *allocTable)(void *pool, JSPRSize size);
|
||||
void (JSJS_DLL_CALLBACK *freeTable)(void *pool, void *item);
|
||||
JSPRHashEntry * (JSJS_DLL_CALLBACK *allocEntry)(void *pool, const void *key);
|
||||
void (JSJS_DLL_CALLBACK *freeEntry)(void *pool, JSPRHashEntry *he, JSPRUintn flag);
|
||||
void * (JSCALLBACK *allocTable)(void *pool, JSPRSize size);
|
||||
void (JSCALLBACK *freeTable)(void *pool, void *item);
|
||||
JSPRHashEntry * (JSCALLBACK *allocEntry)(void *pool, const void *key);
|
||||
void (JSCALLBACK *freeEntry)(void *pool, JSPRHashEntry *he, JSPRUintn flag);
|
||||
} JSPRHashAllocOps;
|
||||
|
||||
#define HT_FREE_VALUE 0 /* just free the entry's value */
|
||||
@@ -79,51 +79,51 @@ struct JSPRHashTable {
|
||||
* Create a new hash table.
|
||||
* If allocOps is null, use default allocator ops built on top of malloc().
|
||||
*/
|
||||
JSJS_EXTERN_API(JSPRHashTable *)
|
||||
JSEXTERN(JSPRHashTable *)
|
||||
JSPR_NewHashTable(JSPRUint32 n, JSPRHashFunction keyHash,
|
||||
JSPRHashComparator keyCompare, JSPRHashComparator valueCompare,
|
||||
JSPRHashAllocOps *allocOps, void *allocPriv);
|
||||
|
||||
JSJS_EXTERN_API(void)
|
||||
JSEXTERN(void)
|
||||
JSPR_HashTableDestroy(JSPRHashTable *ht);
|
||||
|
||||
/* Low level access methods */
|
||||
JSJS_EXTERN_API(JSPRHashEntry **)
|
||||
JSEXTERN(JSPRHashEntry **)
|
||||
JSPR_HashTableRawLookup(JSPRHashTable *ht, JSPRHashNumber keyHash, const void *key);
|
||||
|
||||
JSJS_EXTERN_API(JSPRHashEntry *)
|
||||
JSEXTERN(JSPRHashEntry *)
|
||||
JSPR_HashTableRawAdd(JSPRHashTable *ht, JSPRHashEntry **hep, JSPRHashNumber keyHash,
|
||||
const void *key, void *value);
|
||||
|
||||
JSJS_EXTERN_API(void)
|
||||
JSEXTERN(void)
|
||||
JSPR_HashTableRawRemove(JSPRHashTable *ht, JSPRHashEntry **hep, JSPRHashEntry *he);
|
||||
|
||||
/* Higher level access methods */
|
||||
JSJS_EXTERN_API(JSPRHashEntry *)
|
||||
JSEXTERN(JSPRHashEntry *)
|
||||
JSPR_HashTableAdd(JSPRHashTable *ht, const void *key, void *value);
|
||||
|
||||
JSJS_EXTERN_API(JSPRBool)
|
||||
JSEXTERN(JSPRBool)
|
||||
JSPR_HashTableRemove(JSPRHashTable *ht, const void *key);
|
||||
|
||||
JSJS_EXTERN_API(JSPRIntn)
|
||||
JSEXTERN(JSPRIntn)
|
||||
JSPR_HashTableEnumerateEntries(JSPRHashTable *ht, JSPRHashEnumerator f, void *arg);
|
||||
|
||||
JSJS_EXTERN_API(void *)
|
||||
JSEXTERN(void *)
|
||||
JSPR_HashTableLookup(JSPRHashTable *ht, const void *key);
|
||||
|
||||
JSJS_EXTERN_API(JSPRIntn)
|
||||
JSEXTERN(JSPRIntn)
|
||||
JSPR_HashTableDump(JSPRHashTable *ht, JSPRHashEnumerator dump, FILE *fp);
|
||||
|
||||
/* General-purpose C string hash function. */
|
||||
JSJS_EXTERN_API(JSPRHashNumber)
|
||||
JSEXTERN(JSPRHashNumber)
|
||||
JSPR_HashString(const void *key);
|
||||
|
||||
/* Compare strings using strcmp(), return true if equal. */
|
||||
JSJS_EXTERN_API(int)
|
||||
JSEXTERN(int)
|
||||
JSPR_CompareStrings(const void *v1, const void *v2);
|
||||
|
||||
/* Stub function just returns v1 == v2 */
|
||||
JSJS_EXTERN_API(JSPRIntn)
|
||||
JSEXTERN(JSPRIntn)
|
||||
JSPR_CompareValues(const void *v1, const void *v2);
|
||||
|
||||
JSPR_END_EXTERN_C
|
||||
|
||||
@@ -74,7 +74,6 @@ typedef enum JSTrapStatus {
|
||||
JSTRAP_ERROR,
|
||||
JSTRAP_CONTINUE,
|
||||
JSTRAP_RETURN,
|
||||
JSTRAP_THROW,
|
||||
JSTRAP_LIMIT
|
||||
} JSTrapStatus;
|
||||
|
||||
@@ -146,9 +145,4 @@ typedef void *
|
||||
(* CRT_CALL JSInterpreterHook)(JSContext *cx, JSStackFrame *fp, JSBool before,
|
||||
JSBool *ok, void *closure);
|
||||
|
||||
typedef void
|
||||
(* CRT_CALL JSObjectHook)(JSContext *cx, JSObject *obj, JSBool isNew,
|
||||
void *closure);
|
||||
|
||||
|
||||
#endif /* jsprvtd_h___ */
|
||||
|
||||
@@ -22,9 +22,63 @@
|
||||
* JS public API typedefs.
|
||||
*/
|
||||
#include "jstypes.h"
|
||||
#define NETSCAPE_INTERNAL 1
|
||||
#include "jscompat.h"
|
||||
|
||||
JS_BEGIN_EXTERN_C
|
||||
#ifndef JS_INLINE
|
||||
# ifdef _WIN32
|
||||
# define JS_INLINE __inline
|
||||
# elif defined(__GNUC__)
|
||||
# define JS_INLINE inline
|
||||
# else
|
||||
# define JS_INLINE
|
||||
# endif
|
||||
#endif /* JS_INLINE */
|
||||
|
||||
/*
|
||||
* Downrev NSPR versions of jstypes.h do not define these linkage-related
|
||||
* PR_* macros, so we define them if necessary. Eventually, we should be
|
||||
* able to remove these local definitions (move them to js/ref/jstypes.h,
|
||||
* and get them from an uprev NSPR's jstypes.h for js/src).
|
||||
*/
|
||||
#ifndef IMPORT_API
|
||||
# ifdef _WIN32
|
||||
# define IMPORT_API(__x) _declspec(dllimport) __x
|
||||
# else
|
||||
# define IMPORT_API(__x) IMPLEMENT(__x)
|
||||
# endif
|
||||
#endif /* IMPORT_API */
|
||||
#ifndef IMPORT_DATA
|
||||
# ifdef _WIN32
|
||||
# define IMPORT_DATA(__x) _declspec(dllimport) __x
|
||||
# else
|
||||
# define IMPORT_DATA(__x) __x
|
||||
# endif
|
||||
#endif /* IMPORT_DATA */
|
||||
#ifndef PUBLIC_DATA
|
||||
# ifdef _WIN32
|
||||
# define PUBLIC_DATA(__x) _declspec(dllexport) __x
|
||||
# else
|
||||
# define PUBLIC_DATA(__x) __x
|
||||
# endif
|
||||
#endif /* PUBLIC_DATA */
|
||||
|
||||
/*
|
||||
* The linkage of JS API functions differs depending on whether the file is
|
||||
* used within the JS library or not. Any source file within the JS
|
||||
* interpreter should define EXPORT_JS_API whereas any client of the library
|
||||
* should not.
|
||||
*/
|
||||
#ifdef EXPORT_JS_API
|
||||
#define JS_PUBLIC_API(t) IMPLEMENT(t)
|
||||
#define JS_PUBLIC_DATA(t) PUBLIC_DATA(t)
|
||||
#else
|
||||
#define JS_PUBLIC_API(t) IMPORT_API(t)
|
||||
#define JS_PUBLIC_DATA(t) IMPORT_DATA(t)
|
||||
#endif
|
||||
|
||||
#define JS_FRIEND_API(t) JS_PUBLIC_API(t)
|
||||
#define JS_FRIEND_DATA(t) JS_PUBLIC_DATA(t)
|
||||
|
||||
/* Scalar typedefs. */
|
||||
typedef uint16 jschar;
|
||||
@@ -47,6 +101,8 @@ typedef enum JSVersion {
|
||||
|
||||
#define JSVERSION_IS_ECMA(version) \
|
||||
((version) == JSVERSION_DEFAULT || (version) >= JSVERSION_1_3)
|
||||
#define JSVERSION_IS_ECMAv2(version) \
|
||||
((version) >= JSVERSION_1_3)
|
||||
|
||||
/* Result of typeof operator enumeration. */
|
||||
typedef enum JSType {
|
||||
@@ -237,6 +293,4 @@ typedef const JSErrorFormatString *
|
||||
(* CRT_CALL JSErrorCallback)(void *userRef, const char *locale,
|
||||
const uintN errorNumber);
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
||||
#endif /* jspubtd_h___ */
|
||||
|
||||
@@ -23,7 +23,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
#ifndef NSPR20
|
||||
#include "jsarena.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "plarena.h"
|
||||
*/
|
||||
#include "jsarena.h" /* Added by JSIFY */
|
||||
#endif
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsapi.h"
|
||||
#include "jsarray.h"
|
||||
@@ -1476,7 +1483,7 @@ OptimizeRegExp(CompilerState *state, RENode *ren)
|
||||
len = 1;
|
||||
}
|
||||
cx = state->context;
|
||||
JS_ARENA_ALLOCATE(cp, &cx->tempPool, (len+2) * sizeof(jschar));
|
||||
JS_ARENA_ALLOCATE(cp, &cx->tempPool, len + 2);
|
||||
if (!cp) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
return JS_FALSE;
|
||||
|
||||
@@ -30,7 +30,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
#ifndef NSPR20
|
||||
#include "jsarena.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "plarena.h"
|
||||
*/
|
||||
#include "jsarena.h" /* Added by JSIFY */
|
||||
#endif
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsdtoa.h"
|
||||
#include "jsprf.h"
|
||||
@@ -476,8 +483,6 @@ js_ReportCompileError(JSContext *cx, JSTokenStream *ts, uintN flags,
|
||||
report.uclinebuf = ts->linebuf.base;
|
||||
report.uctokenptr = ts->token.ptr;
|
||||
report.flags = flags;
|
||||
report.errorNumber = 0;
|
||||
|
||||
(*onError)(cx, message, &report);
|
||||
#if !defined XP_PC || !defined _MSC_VER || _MSC_VER > 800
|
||||
} else {
|
||||
@@ -516,8 +521,7 @@ js_ReportCompileErrorNumber(JSContext *cx, JSTokenStream *ts, uintN flags,
|
||||
|
||||
va_start(ap, errorNumber);
|
||||
if (!js_ExpandErrorArguments(cx, js_GetErrorMessage, NULL,
|
||||
errorNumber, &message, &report,
|
||||
JS_TRUE, ap))
|
||||
errorNumber, &message, &report, ap))
|
||||
return;
|
||||
va_end(ap);
|
||||
|
||||
@@ -550,25 +554,16 @@ js_ReportCompileErrorNumber(JSContext *cx, JSTokenStream *ts, uintN flags,
|
||||
* report.flags. Proper behavior for error reporters is probably to
|
||||
* ignore this for all but toplevel compilation errors.
|
||||
|
||||
* XXXmccabe it's still at issue if there's a public API to distinguish
|
||||
* between toplevel compilation and other types.
|
||||
|
||||
* XXX it'd probably be best if there was only one call to this
|
||||
* function, but there seem to be two error reporter call points.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Only try to raise an exception if there isn't one already set -
|
||||
* otherwise the exception will describe the last syntax error, which
|
||||
* is likely spurious.
|
||||
*/
|
||||
if (!JS_IsExceptionPending(cx))
|
||||
(void)js_ErrorToException(cx, &report, message);
|
||||
|
||||
/*
|
||||
* If compiletime errors are already reflected as exceptions, suppress
|
||||
* any compiletime errors that don't occur at the top level.
|
||||
*/
|
||||
if (cx->interpLevel == 0)
|
||||
(void)js_ErrorToException(cx, &report, message);
|
||||
#endif
|
||||
(*onError)(cx, message, &report);
|
||||
|
||||
(*onError)(cx, message, &report);
|
||||
|
||||
#if !defined XP_PC || !defined _MSC_VER || _MSC_VER > 800
|
||||
} else {
|
||||
@@ -586,8 +581,8 @@ js_ReportCompileErrorNumber(JSContext *cx, JSTokenStream *ts, uintN flags,
|
||||
}
|
||||
if (lastc == '\n')
|
||||
limit[-1] = lastc;
|
||||
if (message) JS_free(cx, message);
|
||||
if (report.messageArgs) JS_free(cx, (void *)report.messageArgs);
|
||||
if (message) free(message);
|
||||
if (report.messageArgs) free(report.messageArgs);
|
||||
}
|
||||
|
||||
JSTokenType
|
||||
@@ -746,13 +741,12 @@ retry:
|
||||
} else if (JS7_ISDEC(c)) {
|
||||
/*
|
||||
* We permit 08 and 09 as decimal numbers, which makes our
|
||||
* behaviour a superset of the ECMA numeric grammar. We might
|
||||
* behaviour superset of the ECMA numeric grammar. We might
|
||||
* not always be so permissive, so we warn about it.
|
||||
*/
|
||||
if (c > '7' && JSVERSION_IS_ECMA(cx->version)) {
|
||||
js_ReportCompileErrorNumber(cx, ts, JSREPORT_WARNING,
|
||||
JSMSG_BAD_OCTAL,
|
||||
c == '8' ? "08" : "09");
|
||||
js_ReportCompileError(cx, ts, JSREPORT_WARNING,
|
||||
"0%c is not a legal ECMA-262 numeric constant", c);
|
||||
radix = 10;
|
||||
} else {
|
||||
radix = 8;
|
||||
@@ -786,8 +780,8 @@ retry:
|
||||
c = GetChar(ts);
|
||||
}
|
||||
if (!JS7_ISDEC(c)) {
|
||||
js_ReportCompileErrorNumber(cx, ts, JSREPORT_ERROR,
|
||||
JSMSG_MISSING_EXPONENT);
|
||||
js_ReportCompileError(cx, ts, JSREPORT_ERROR,
|
||||
"missing exponent");
|
||||
RETURN(TOK_ERROR);
|
||||
}
|
||||
do {
|
||||
@@ -803,14 +797,14 @@ retry:
|
||||
|
||||
if (radix == 10) {
|
||||
if (!js_strtod(cx, ts->tokenbuf.base, &endptr, &dval)) {
|
||||
js_ReportCompileErrorNumber(cx, ts, JSREPORT_ERROR,
|
||||
JSMSG_OUT_OF_MEMORY);
|
||||
js_ReportCompileError(cx, ts, JSREPORT_ERROR,
|
||||
"out of memory");
|
||||
RETURN(TOK_ERROR);
|
||||
}
|
||||
} else {
|
||||
if (!js_strtointeger(cx, ts->tokenbuf.base, &endptr, radix, &dval)) {
|
||||
js_ReportCompileErrorNumber(cx, ts, JSREPORT_ERROR,
|
||||
JSMSG_OUT_OF_MEMORY);
|
||||
js_ReportCompileError(cx, ts, JSREPORT_ERROR,
|
||||
"out of memory");
|
||||
RETURN(TOK_ERROR);
|
||||
}
|
||||
}
|
||||
@@ -825,8 +819,8 @@ retry:
|
||||
while ((c = GetChar(ts)) != qc) {
|
||||
if (c == '\n' || c == EOF) {
|
||||
UngetChar(ts, c);
|
||||
js_ReportCompileErrorNumber(cx, ts, JSREPORT_ERROR,
|
||||
JSMSG_UNTERMINATED_STRING);
|
||||
js_ReportCompileError(cx, ts, JSREPORT_ERROR,
|
||||
"unterminated string literal");
|
||||
RETURN(TOK_ERROR);
|
||||
}
|
||||
if (c == '\\') {
|
||||
@@ -1015,13 +1009,13 @@ skipline:
|
||||
if (c == '/' && MatchChar(ts, '*')) {
|
||||
if (MatchChar(ts, '/'))
|
||||
goto retry;
|
||||
js_ReportCompileErrorNumber(cx, ts, JSREPORT_ERROR,
|
||||
JSMSG_NESTED_COMMENT);
|
||||
js_ReportCompileError(cx, ts, JSREPORT_ERROR,
|
||||
"nested comment");
|
||||
}
|
||||
}
|
||||
if (c == EOF) {
|
||||
js_ReportCompileErrorNumber(cx, ts, JSREPORT_ERROR,
|
||||
JSMSG_UNTERMINATED_COMMENT);
|
||||
js_ReportCompileError(cx, ts, JSREPORT_ERROR,
|
||||
"unterminated comment");
|
||||
RETURN(TOK_ERROR);
|
||||
}
|
||||
goto retry;
|
||||
@@ -1036,8 +1030,8 @@ skipline:
|
||||
while ((c = GetChar(ts)) != '/') {
|
||||
if (c == '\n' || c == EOF) {
|
||||
UngetChar(ts, c);
|
||||
js_ReportCompileErrorNumber(cx, ts, JSREPORT_ERROR,
|
||||
JSMSG_UNTERMINATED_REGEXP);
|
||||
js_ReportCompileError(cx, ts,JSREPORT_ERROR,
|
||||
"unterminated regular expression literal");
|
||||
RETURN(TOK_ERROR);
|
||||
}
|
||||
if (c == '\\') {
|
||||
@@ -1060,8 +1054,8 @@ skipline:
|
||||
c = PeekChar(ts);
|
||||
if (JS7_ISLET(c)) {
|
||||
ts->token.ptr = ts->linebuf.ptr - 1;
|
||||
js_ReportCompileErrorNumber(cx, ts,JSREPORT_ERROR,
|
||||
JSMSG_BAD_REGEXP_FLAG);
|
||||
js_ReportCompileError(cx, ts,JSREPORT_ERROR,
|
||||
"invalid flag after regular expression");
|
||||
(void) GetChar(ts);
|
||||
RETURN(TOK_ERROR);
|
||||
}
|
||||
@@ -1127,8 +1121,8 @@ skipline:
|
||||
break;
|
||||
n = 10 * n + JS7_UNDEC(c);
|
||||
if (n >= ATOM_INDEX_LIMIT) {
|
||||
js_ReportCompileErrorNumber(cx, ts, JSREPORT_ERROR,
|
||||
JSMSG_SHARPVAR_TOO_BIG);
|
||||
js_ReportCompileError(cx, ts,JSREPORT_ERROR,
|
||||
"overlarge sharp variable number");
|
||||
RETURN(TOK_ERROR);
|
||||
}
|
||||
}
|
||||
@@ -1144,8 +1138,8 @@ skipline:
|
||||
#endif /* JS_HAS_SHARP_VARS */
|
||||
|
||||
default:
|
||||
js_ReportCompileErrorNumber(cx, ts, JSREPORT_ERROR,
|
||||
JSMSG_ILLEGAL_CHARACTER);
|
||||
js_ReportCompileError(cx, ts, JSREPORT_ERROR,
|
||||
"illegal character");
|
||||
RETURN(TOK_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "jsstddef.h"
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsapi.h"
|
||||
#include "jsatom.h"
|
||||
@@ -32,7 +33,7 @@
|
||||
#include "jsscope.h"
|
||||
#include "jsstr.h"
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(JSHashNumber)
|
||||
STATIC_DLL_CALLBACK(JSHashNumber)
|
||||
js_hash_id(const void *key)
|
||||
{
|
||||
jsval v;
|
||||
@@ -50,19 +51,19 @@ typedef struct JSScopePrivate {
|
||||
JSScope *scope;
|
||||
} JSScopePrivate;
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(void *)
|
||||
STATIC_DLL_CALLBACK(void *)
|
||||
js_alloc_scope_space(void *priv, size_t size)
|
||||
{
|
||||
return JS_malloc(((JSScopePrivate *)priv)->context, size);
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(void)
|
||||
STATIC_DLL_CALLBACK(void)
|
||||
js_free_scope_space(void *priv, void *item)
|
||||
{
|
||||
JS_free(((JSScopePrivate *)priv)->context, item);
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(JSHashEntry *)
|
||||
STATIC_DLL_CALLBACK(JSHashEntry *)
|
||||
js_alloc_symbol(void *priv, const void *key)
|
||||
{
|
||||
JSScopePrivate *spriv;
|
||||
@@ -79,7 +80,7 @@ js_alloc_symbol(void *priv, const void *key)
|
||||
return &sym->entry;
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(void)
|
||||
STATIC_DLL_CALLBACK(void)
|
||||
js_free_symbol(void *priv, JSHashEntry *he, uintN flag)
|
||||
{
|
||||
JSScopePrivate *spriv;
|
||||
@@ -118,7 +119,7 @@ static JSHashAllocOps hash_scope_alloc_ops = {
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(JSSymbol *)
|
||||
STATIC_DLL_CALLBACK(JSSymbol *)
|
||||
js_hash_scope_lookup(JSContext *cx, JSScope *scope, jsid id, JSHashNumber hash)
|
||||
{
|
||||
JSHashTable *table = scope->data;
|
||||
@@ -152,7 +153,7 @@ js_hash_scope_lookup(JSContext *cx, JSScope *scope, jsid id, JSHashNumber hash)
|
||||
} \
|
||||
JS_END_MACRO
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(JSSymbol *)
|
||||
STATIC_DLL_CALLBACK(JSSymbol *)
|
||||
js_hash_scope_add(JSContext *cx, JSScope *scope, jsid id, JSScopeProperty *sprop)
|
||||
{
|
||||
JSHashTable *table = scope->data;
|
||||
@@ -177,7 +178,7 @@ js_hash_scope_add(JSContext *cx, JSScope *scope, jsid id, JSScopeProperty *sprop
|
||||
return sym;
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(JSBool)
|
||||
STATIC_DLL_CALLBACK(JSBool)
|
||||
js_hash_scope_remove(JSContext *cx, JSScope *scope, jsid id)
|
||||
{
|
||||
JSHashTable *table = scope->data;
|
||||
@@ -192,7 +193,7 @@ js_hash_scope_remove(JSContext *cx, JSScope *scope, jsid id)
|
||||
/* Forward declaration for use by js_hash_scope_clear(). */
|
||||
extern JS_FRIEND_DATA(JSScopeOps) js_list_scope_ops;
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(void)
|
||||
STATIC_DLL_CALLBACK(void)
|
||||
js_hash_scope_clear(JSContext *cx, JSScope *scope)
|
||||
{
|
||||
JSHashTable *table = scope->data;
|
||||
@@ -216,7 +217,7 @@ JSScopeOps js_hash_scope_ops = {
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(JSSymbol *)
|
||||
STATIC_DLL_CALLBACK(JSSymbol *)
|
||||
js_list_scope_lookup(JSContext *cx, JSScope *scope, jsid id, JSHashNumber hash)
|
||||
{
|
||||
JSSymbol *sym, **sp;
|
||||
@@ -237,7 +238,7 @@ js_list_scope_lookup(JSContext *cx, JSScope *scope, jsid id, JSHashNumber hash)
|
||||
|
||||
#define HASH_THRESHOLD 5
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(JSSymbol *)
|
||||
STATIC_DLL_CALLBACK(JSSymbol *)
|
||||
js_list_scope_add(JSContext *cx, JSScope *scope, jsid id, JSScopeProperty *sprop)
|
||||
{
|
||||
JSSymbol *list = scope->data;
|
||||
@@ -296,7 +297,7 @@ js_list_scope_add(JSContext *cx, JSScope *scope, jsid id, JSScopeProperty *sprop
|
||||
return sym;
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(JSBool)
|
||||
STATIC_DLL_CALLBACK(JSBool)
|
||||
js_list_scope_remove(JSContext *cx, JSScope *scope, jsid id)
|
||||
{
|
||||
JSSymbol *sym, **sp;
|
||||
@@ -316,7 +317,7 @@ js_list_scope_remove(JSContext *cx, JSScope *scope, jsid id)
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(void)
|
||||
STATIC_DLL_CALLBACK(void)
|
||||
js_list_scope_clear(JSContext *cx, JSScope *scope)
|
||||
{
|
||||
JSSymbol *sym;
|
||||
|
||||
@@ -22,7 +22,13 @@
|
||||
* JS symbol tables.
|
||||
*/
|
||||
#include "jstypes.h"
|
||||
#ifndef NSPR20
|
||||
#include "jshash.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "JShash.h"
|
||||
*/
|
||||
#include "jshash.h" /* Added by JSIFY */
|
||||
#endif
|
||||
#include "jsobj.h"
|
||||
#include "jsprvtd.h"
|
||||
#include "jspubtd.h"
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "jsstddef.h"
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsprf.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
@@ -1,23 +1,10 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
/* -*- Mode: C; tab-width: 8 -*-
|
||||
* Copyright (C) 1998 Netscape Communications Corporation, All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
Error messages for JSShell. See js.msg for format.
|
||||
Error messages for JSShell. See JSJMSG.def for format.
|
||||
|
||||
*/
|
||||
|
||||
MSG_DEF(JSSMSG_NOT_AN_ERROR, 0, 0, JSEXN_NONE, "<Error #0 is reserved>")
|
||||
|
||||
@@ -30,8 +30,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#ifndef NSPR20
|
||||
#include "jshash.h"
|
||||
#else
|
||||
/* Removed by JSIFY: #include "JShash.h"
|
||||
*/
|
||||
#include "jshash.h" /* Added by JSIFY */
|
||||
#endif
|
||||
#include "jsprf.h"
|
||||
#include "jsapi.h"
|
||||
#include "jsarray.h"
|
||||
@@ -1320,6 +1327,8 @@ find_split(JSContext *cx, JSString *str, JSRegExp *re, jsint *ip,
|
||||
|
||||
again:
|
||||
/* JS1.2 deviated from Perl by never matching at end of string. */
|
||||
if (cx->version == JSVERSION_1_2 && (size_t)i == str->length)
|
||||
return -1;
|
||||
index = (size_t)i;
|
||||
if (!js_ExecuteRegExp(cx, re, str, &index, JS_TRUE, &rval))
|
||||
return -2;
|
||||
@@ -2095,7 +2104,7 @@ js_NewStringCopyZ(JSContext *cx, const jschar *s, uintN gcflag)
|
||||
return str;
|
||||
}
|
||||
|
||||
JS_STATIC_DLL_CALLBACK(JSHashNumber)
|
||||
STATIC_DLL_CALLBACK(JSHashNumber)
|
||||
js_hash_string_pointer(const void *key)
|
||||
{
|
||||
return (JSHashNumber)key >> JSVAL_TAGBITS;
|
||||
@@ -2171,10 +2180,9 @@ js_ValueToSource(JSContext *cx, jsval v)
|
||||
if (JSVAL_IS_STRING(v))
|
||||
return js_QuoteString(cx, JSVAL_TO_STRING(v), '"');
|
||||
if (!JSVAL_IS_PRIMITIVE(v)) {
|
||||
if (!js_TryMethod(cx, JSVAL_TO_OBJECT(v),
|
||||
js_TryMethod(cx, JSVAL_TO_OBJECT(v),
|
||||
cx->runtime->atomState.toSourceAtom,
|
||||
0, NULL, &v))
|
||||
return NULL;
|
||||
0, NULL, &v);
|
||||
}
|
||||
return js_ValueToString(cx, v);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <ctype.h>
|
||||
#include "jspubtd.h"
|
||||
#include "jsprvtd.h"
|
||||
#include "jshash.h"
|
||||
|
||||
JS_BEGIN_EXTERN_C
|
||||
|
||||
|
||||
@@ -36,117 +36,90 @@
|
||||
#include <stddef.h>
|
||||
|
||||
/***********************************************************************
|
||||
** MACROS: JS_EXTERN_API
|
||||
** JS_EXPORT_API
|
||||
** MACROS: EXTERN
|
||||
** IMPLEMENT
|
||||
** DESCRIPTION:
|
||||
** These are only for externally visible routines and globals. For
|
||||
** internal routines, just use "extern" for type checking and that
|
||||
** will not export internal cross-file or forward-declared symbols.
|
||||
** Define a macro for declaring procedures return types. We use this to
|
||||
** deal with windoze specific type hackery for DLL definitions. Use
|
||||
** JS_EXTERN_API when the prototype for the method is declared. Use
|
||||
** JS_EXPORT_API for the implementation of the method.
|
||||
** EXTERN when the prototype for the method is declared. Use
|
||||
** IMPLEMENT for the implementation of the method.
|
||||
**
|
||||
** Example:
|
||||
** in dowhim.h
|
||||
** JS_EXTERN_API( void ) DoWhatIMean( void );
|
||||
** EXTERN( void ) DoWhatIMean( void );
|
||||
** in dowhim.c
|
||||
** JS_EXPORT_API( void ) DoWhatIMean( void ) { return; }
|
||||
** IMPLEMENT( void ) DoWhatIMean( void ) { return; }
|
||||
**
|
||||
**
|
||||
***********************************************************************/
|
||||
#ifdef WIN32
|
||||
#define JS_EXTERN_API(__type) extern _declspec(dllexport) __type
|
||||
#define JS_EXPORT_API(__type) _declspec(dllexport) __type
|
||||
#define JS_EXTERN_DATA(__type) extern _declspec(dllexport) __type
|
||||
#define JS_EXPORT_DATA(__type) _declspec(dllexport) __type
|
||||
#define EXTERN(__type) extern _declspec(dllexport) __type
|
||||
#define IMPLEMENT(__type) _declspec(dllexport) __type
|
||||
#define EXTERN_DATA(__type) extern _declspec(dllexport) __type
|
||||
#define IMPLEMENT_DATA(__type) _declspec(dllexport) __type
|
||||
|
||||
#define JS_DLL_CALLBACK
|
||||
#define JS_STATIC_DLL_CALLBACK(__x) static __x
|
||||
#define DLL_CALLBACK
|
||||
#define CALLBACK_DECL
|
||||
#define STATIC_DLL_CALLBACK(__x) static __x
|
||||
|
||||
#elif defined(WIN16)
|
||||
|
||||
#ifdef _WINDLL
|
||||
#define JS_EXTERN_API(__type) extern __type _cdecl _export _loadds
|
||||
#define JS_EXPORT_API(__type) __type _cdecl _export _loadds
|
||||
#define JS_EXTERN_DATA(__type) extern __type _export
|
||||
#define JS_EXPORT_DATA(__type) __type _export
|
||||
#define CALLBACK_DECL __cdecl
|
||||
|
||||
#define JS_DLL_CALLBACK __cdecl __loadds
|
||||
#define JS_STATIC_DLL_CALLBACK(__x) static __x CALLBACK
|
||||
#ifdef _WINDLL
|
||||
#define EXTERN(__type) extern __type _cdecl _export _loadds
|
||||
#define IMPLEMENT(__type) __type _cdecl _export _loadds
|
||||
#define EXTERN_DATA(__type) extern __type _export
|
||||
#define IMPLEMENT_DATA(__type) __type _export
|
||||
|
||||
#define DLL_CALLBACK __cdecl __loadds
|
||||
#define STATIC_DLL_CALLBACK(__x) static __x CALLBACK
|
||||
|
||||
#else /* this must be .EXE */
|
||||
#define JS_EXTERN_API(__type) extern __type _cdecl _export
|
||||
#define JS_EXPORT_API(__type) __type _cdecl _export
|
||||
#define JS_EXTERN_DATA(__type) extern __type _export
|
||||
#define JS_EXPORT_DATA(__type) __type _export
|
||||
#define EXTERN(__type) extern __type _cdecl _export
|
||||
#define IMPLEMENT(__type) __type _cdecl _export
|
||||
#define EXTERN_DATA(__type) extern __type _export
|
||||
#define IMPLEMENT_DATA(__type) __type _export
|
||||
|
||||
#define JS_DLL_CALLBACK __cdecl __loadds
|
||||
#define JS_STATIC_DLL_CALLBACK(__x) __x JS_DLL_CALLBACK
|
||||
#define DLL_CALLBACK __cdecl __loadds
|
||||
#define STATIC_DLL_CALLBACK(__x) __x 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 EXTERN(__type) extern __declspec(export) __type
|
||||
#define IMPLEMENT(__type) __declspec(export) __type
|
||||
#define EXTERN_DATA(__type) extern __declspec(export) __type
|
||||
#define IMPLEMENT_DATA(__type) __declspec(export) __type
|
||||
|
||||
#define JS_DLL_CALLBACK
|
||||
#define JS_STATIC_DLL_CALLBACK(__x) static __x
|
||||
#define DLL_CALLBACK
|
||||
#define CALLBACK_DECL
|
||||
#define STATIC_DLL_CALLBACK(__x) static __x
|
||||
|
||||
#elif defined(XP_OS2)
|
||||
#define JS_EXTERN_API(__type) extern __type
|
||||
#define JS_EXPORT_API(__type) __type
|
||||
#define JS_EXTERN_DATA(__type) extern __type
|
||||
#define JS_EXPORT_DATA(__type) __type
|
||||
#define JS_DLL_CALLBACK
|
||||
#define JS_STATIC_DLL_CALLBACK(__x) __x _Optlink
|
||||
#define EXTERN(__type) extern __type
|
||||
#define IMPLEMENT(__type) __type
|
||||
#define EXTERN_DATA(__type) extern __type
|
||||
#define IMPLEMENT_DATA(__type) __type
|
||||
#define DLL_CALLBACK
|
||||
#define CALLBACK_DECL
|
||||
#define STATIC_DLL_CALLBACK(__x) __x _Optlink
|
||||
|
||||
#else /* Unix */
|
||||
#define JS_EXTERN_API(__type) extern __type
|
||||
#define JS_EXPORT_API(__type) __type
|
||||
#define JS_EXTERN_DATA(__type) extern __type
|
||||
#define JS_EXPORT_DATA(__type) __type
|
||||
#define JS_DLL_CALLBACK
|
||||
#define JS_STATIC_DLL_CALLBACK(__x) static __x
|
||||
#define EXTERN(__type) extern __type
|
||||
#define IMPLEMENT(__type) __type
|
||||
#define EXTERN_DATA(__type) extern __type
|
||||
#define IMPLEMENT_DATA(__type) __type
|
||||
#define DLL_CALLBACK
|
||||
#define CALLBACK_DECL
|
||||
#define STATIC_DLL_CALLBACK(__x) static __x
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# define JS_IMPORT_API(__x) _declspec(dllimport) __x
|
||||
#else
|
||||
# define JS_IMPORT_API(__x) JS_EXPORT_API (__x)
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# define JS_IMPORT_DATA(__x) _declspec(dllimport) __x
|
||||
#else
|
||||
# define JS_IMPORT_DATA(__x) __x
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The linkage of JS API functions differs depending on whether the file is
|
||||
* used within the JS library or not. Any source file within the JS
|
||||
* interpreter should define EXPORT_JS_API whereas any client of the library
|
||||
* should not.
|
||||
*/
|
||||
#ifdef EXPORT_JS_API
|
||||
#define JS_PUBLIC_API(t) JS_EXPORT_API(t)
|
||||
#define JS_PUBLIC_DATA(t) JS_EXPORT_DATA(t)
|
||||
#else
|
||||
#define JS_PUBLIC_API(t) JS_IMPORT_API(t)
|
||||
#define JS_PUBLIC_DATA(t) JS_IMPORT_DATA(t)
|
||||
#endif
|
||||
|
||||
#define JS_FRIEND_API(t) JS_PUBLIC_API(t)
|
||||
#define JS_FRIEND_DATA(t) JS_PUBLIC_DATA(t)
|
||||
|
||||
#ifdef _WIN32
|
||||
# define JS_INLINE __inline
|
||||
#elif defined(__GNUC__)
|
||||
# define JS_INLINE
|
||||
#else
|
||||
# define JS_INLINE
|
||||
#ifndef NO_NSPR_10_SUPPORT
|
||||
#define PUBLIC_API IMPLEMENT
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
@@ -351,13 +324,53 @@ typedef JSUint8 JSPackedBool;
|
||||
*/
|
||||
typedef enum { JS_FAILURE = -1, JS_SUCCESS = 0 } JSStatus;
|
||||
|
||||
#ifdef NO_NSPR_10_SUPPORT
|
||||
#else
|
||||
/********* ???????????????? FIX ME ??????????????????????????? *****/
|
||||
/********************** Some old definitions until pr=>ds transition is done ***/
|
||||
/********************** Also, we are still using NSPR 1.0. GC ******************/
|
||||
/*
|
||||
** Fundamental NSPR macros, used nearly everywhere.
|
||||
*/
|
||||
|
||||
/*
|
||||
** Macro body brackets so that macros with compound statement definitions
|
||||
** behave syntactically more like functions when called.
|
||||
*/
|
||||
#define NSPR_BEGIN_MACRO do {
|
||||
#define NSPR_END_MACRO } while (0)
|
||||
|
||||
/*
|
||||
** Macro shorthands for conditional C++ extern block delimiters.
|
||||
*/
|
||||
#ifdef NSPR_BEGIN_EXTERN_C
|
||||
#undef NSPR_BEGIN_EXTERN_C
|
||||
#endif
|
||||
#ifdef NSPR_END_EXTERN_C
|
||||
#undef NSPR_END_EXTERN_C
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define NSPR_BEGIN_EXTERN_C extern "C" {
|
||||
#define NSPR_END_EXTERN_C }
|
||||
#else
|
||||
#define NSPR_BEGIN_EXTERN_C
|
||||
#define NSPR_END_EXTERN_C
|
||||
#endif
|
||||
|
||||
/*
|
||||
** A JSWord is an integer that is the same size as a void*
|
||||
*/
|
||||
typedef long JSWord;
|
||||
typedef unsigned long JSUword;
|
||||
|
||||
/********* ????????????? End Fix me ?????????????????????????????? *****/
|
||||
#endif /* NO_NSPR_10_SUPPORT */
|
||||
|
||||
#include "jsotypes.h"
|
||||
#ifndef NSPR20
|
||||
#define NSPR20 1
|
||||
#endif
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
||||
|
||||
@@ -28,94 +28,7 @@
|
||||
# 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 debugstr(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);
|
||||
|
||||
debugstr(buffer);
|
||||
JS_DELETE(buffer);
|
||||
}
|
||||
#endif /* XP_MAC */
|
||||
|
||||
JS_EXPORT_API(void) JS_Assert(const char *s, const char *file, JSIntn ln)
|
||||
IMPLEMENT(void) JS_Assert(const char *s, const char *file, JSIntn ln)
|
||||
{
|
||||
#if defined(XP_UNIX) || defined(XP_OS2)
|
||||
fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln);
|
||||
|
||||
@@ -58,7 +58,7 @@ JS_BEGIN_EXTERN_C
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
JS_EXTERN_API(void) JS_Assert(const char *s, const char *file, JSIntn ln);
|
||||
EXTERN(void) JS_Assert(const char *s, const char *file, JSIntn ln);
|
||||
#define JS_ASSERT(_expr) \
|
||||
((_expr)?((void)0):JS_Assert(# _expr,__FILE__,__LINE__))
|
||||
|
||||
@@ -77,7 +77,7 @@ JS_EXTERN_API(void) JS_Assert(const char *s, const char *file, JSIntn ln);
|
||||
** call to the debugger or other moral equivalent as well as causing the
|
||||
** entire process to stop.
|
||||
*/
|
||||
JS_EXTERN_API(void) JS_Abort(void);
|
||||
EXTERN(void) JS_Abort(void);
|
||||
|
||||
JS_END_EXTERN_C
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <string.h>
|
||||
#include "jstypes.h"
|
||||
/* Removed by JSIFY: #include "prlog.h" */
|
||||
#include "jsutil.h" /* Added by JSIFY */
|
||||
#include "jsprf.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
@@ -3,6 +3,3 @@
|
||||
|
||||
jsjava.h
|
||||
nsILiveconnect.h
|
||||
nsISecureLiveconnect.h
|
||||
nsISecurityContext.h
|
||||
netscape_javascript_JSObject.h
|
||||
|
||||
@@ -28,10 +28,8 @@ endif
|
||||
MODULE = java
|
||||
LIBRARY_NAME = jsj
|
||||
|
||||
REQUIRES = java js applet nspr img util layer
|
||||
ifdef MOZ_OJI
|
||||
REQUIRES += xpcom
|
||||
endif
|
||||
REQUIRES = java js applet nspr img util layer xpcom
|
||||
|
||||
CSRCS = jsj.c \
|
||||
jsj_JSObject.c \
|
||||
jsj_JavaArray.c \
|
||||
@@ -45,19 +43,13 @@ CSRCS = jsj.c \
|
||||
jsj_field.c \
|
||||
jsj_hash.c \
|
||||
jsj_method.c \
|
||||
jsj_utils.c
|
||||
jsj_utils.c \
|
||||
nsCLiveconnect.c \
|
||||
nsCLiveconnectFactory.c
|
||||
|
||||
ifdef MOZ_OJI
|
||||
CPPSRCS = \
|
||||
nsCLiveconnect.cpp \
|
||||
nsCLiveconnectFactory.cpp
|
||||
endif
|
||||
|
||||
LLIBS=$(LIBNSPR) $(DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib
|
||||
ifdef MOZ_OJI
|
||||
LLIBS += $(DIST)/lib/xpcom32.lib
|
||||
endif
|
||||
|
||||
LLIBS=$(LIBNSPR) $(DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib \
|
||||
$(DIST)/lib/xpcom32.lib
|
||||
|
||||
|
||||
ifdef NSJVM
|
||||
@@ -67,13 +59,8 @@ endif
|
||||
EXPORTS = jsjava.h \
|
||||
$(JNI_GEN_DIR)/netscape_javascript_JSObject.h \
|
||||
$(JNI_GEN_DIR)/netscape_javascript_JSException.h \
|
||||
nsILiveconnect.h \
|
||||
$(NULL)
|
||||
ifdef MOZ_OJI
|
||||
EXPORTS += nsILiveconnect.h \
|
||||
nsISecureLiveconnect.h \
|
||||
nsISecurityContext.h \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -30,13 +30,12 @@ ifdef NSJVM
|
||||
DIRS = classes
|
||||
endif
|
||||
|
||||
|
||||
MODULE = java
|
||||
LIBRARY_NAME = jsj
|
||||
|
||||
REQUIRES = java js applet nspr img util layer
|
||||
ifdef MOZ_OJI
|
||||
REQUIRES += xpcom
|
||||
endif
|
||||
REQUIRES = java js applet nspr img util layer xpcom caps oji plugin
|
||||
|
||||
CSRCS = jsj.c \
|
||||
jsj_JSObject.c \
|
||||
jsj_JavaArray.c \
|
||||
@@ -51,18 +50,8 @@ CSRCS = jsj.c \
|
||||
jsj_hash.c \
|
||||
jsj_method.c \
|
||||
jsj_utils.c
|
||||
|
||||
ifdef MOZ_OJI
|
||||
CPPSRCS = \
|
||||
nsCLiveconnect.cpp \
|
||||
nsCLiveconnectFactory.cpp
|
||||
endif
|
||||
|
||||
LLIBS=$(LIBNSPR) $(DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib
|
||||
ifdef MOZ_OJI
|
||||
LLIBS += $(DIST)/lib/xpcom32.lib
|
||||
endif
|
||||
|
||||
nsCLiveconnect.c \
|
||||
nsCLiveconnectFactory.c
|
||||
|
||||
|
||||
ifdef NSJVM
|
||||
@@ -73,12 +62,6 @@ EXPORTS = $(srcdir)/jsjava.h \
|
||||
$(srcdir)/$(JNI_GEN_DIR)/netscape_javascript_JSObject.h \
|
||||
$(srcdir)/$(JNI_GEN_DIR)/netscape_javascript_JSException.h \
|
||||
$(NULL)
|
||||
ifdef MOZ_OJI
|
||||
EXPORTS += $(srcdir)/nsILiveconnect.h \
|
||||
$(srcdir)/nsISecureLiveconnect.h \
|
||||
$(srcdir)/nsISecurityContext.h \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
||||
|
||||
@@ -90,16 +73,16 @@ include $(topsrcdir)/config/rules.mk
|
||||
# These make rules only works on IRIX...sigh
|
||||
|
||||
ifeq ($(OS_ARCH),IRIX)
|
||||
jsj_nodl.c: $(OBJDIR)/stubs.o Makefile $(DEPTH)/config/nodl.pl
|
||||
jsj_nodl.c: $(OBJDIR)/stubs.o Makefile $(topsrcdir)/config/nodl.pl
|
||||
rm -f $@
|
||||
$(PERL) $(DEPTH)/config/nodl.pl "jsj_nodl_tab" \
|
||||
$(PERL) $(topsrcdir)/config/nodl.pl "jsj_nodl_tab" \
|
||||
`nm -Bn $(OBJDIR)/stubs.o | egrep Java_.*_stub | awk '{print $$3;}'` > $@
|
||||
endif
|
||||
|
||||
ifdef JAVA_OR_OJI
|
||||
$(OBJDIR)/stubs.o: \
|
||||
$(JNI_GEN_DIR)/netscape_javascript_JSObject.c \
|
||||
$(JNI_GEN_DIR)/netscape_javascript_JSException.c \
|
||||
$(JRI_GEN_DIR)/netscape_javascript_JSObject.c \
|
||||
$(JRI_GEN_DIR)/netscape_javascript_JSException.c \
|
||||
$(NULL)
|
||||
else
|
||||
$(OBJDIR)/stubs.o:
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include "jni.h"
|
||||
|
||||
/* Header for class netscape_javascript_JSException */
|
||||
|
||||
#ifndef _Included_netscape_javascript_JSException
|
||||
#define _Included_netscape_javascript_JSException
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user