add js to tree
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3693 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
855c7b9a77
commit
fff98f6316
|
@ -0,0 +1,17 @@
|
|||
_ ___ ____ ____ ____ _
|
||||
|_|_ _ / _ \/ ___/ ___|| _ \ (_)___
|
||||
_|_||_| | | | \___ \___ \| |_) | | / __|
|
||||
|_||_|_| | |_| |___) |__) | __/ | \__ \
|
||||
|_|_|_| \___/|____/____/|_| _/ |___/
|
||||
|__/
|
||||
|
||||
OSSP js - Mozilla JavaScript Engine
|
||||
|
||||
LINKS
|
||||
|
||||
Brendan Eich <brendan@mozilla.org> et al
|
||||
- Mozilla JavaScript implementation
|
||||
|
||||
Ralf S. Engelschall <rse@engelschall.com>
|
||||
- OSSP js distribution of Mozilla JavaScript
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
_ ___ ____ ____ ____ _
|
||||
|_|_ _ / _ \/ ___/ ___|| _ \ (_)___
|
||||
_|_||_| | | | \___ \___ \| |_) | | / __|
|
||||
|_||_|_| | |_| |___) |__) | __/ | \__ \
|
||||
|_|_|_| \___/|____/____/|_| _/ |___/
|
||||
|__/
|
||||
|
||||
OSSP js - Mozilla JavaScript Engine
|
||||
|
||||
CHANGELOG
|
||||
|
||||
This is a list of all changes to OSSP js.
|
||||
|
||||
Changes between 1.6.20060803 and 1.6.20060820 (2006-08-03 to 2006-08-20)
|
||||
|
||||
o Add support for UTF-8 C strings in the API and internally by
|
||||
adding a --with-utf8 build-time options which builds the code
|
||||
with JS_C_STRINGS_ARE_UTF8.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
o Upgrade to upstream sources as of 2006-08-20.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
Changes between 1.6.20060731 and 1.6.20060803 (2006-07-31 to 2006-08-03)
|
||||
|
||||
o Add optional Dynamic Shared Object (DSO) support (see src/jsdso.[ch]).
|
||||
This comes in two flavors:
|
||||
|
||||
1. Provide two public C API functions...
|
||||
JSBool JS_DSOLoad (JSContext *cx, int *id, const char *filename);
|
||||
JSBool JS_DSOUnload (JSContext *cx, int id);
|
||||
...as an ultra-thin wrapper around the POSIX dlopen(3) API. It
|
||||
especially mimics the BSD RTLD behaviour of calling pre-defined
|
||||
functions (mandatory "js_DSO_load" and optional "js_DSO_unload")
|
||||
inside the DSO after/before the dlopen/dlclose calls. This
|
||||
allows the DSOs to perform their init/shutdown actions.
|
||||
|
||||
2. Provide a small JavaScript global object "DSO" which binds
|
||||
the two public DSO C API functions into the JavaScript language
|
||||
as "DSO.load" and "DSO.unload". The "DSO" object can be created
|
||||
by the friend C API function js_InitDSOClass(). This function is
|
||||
used by the command-linne interface "js" by default.
|
||||
|
||||
As a result the OSSP Mozilla JavaScript engine is now able to
|
||||
dynamically load C extensions similar to what other programming
|
||||
languages provide since a longer time.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
o Be more clean and replace weak "#if JS_HAS_FILE_OBJECT" constructs
|
||||
with the stronger "#if defined(JS_HAS_FILE_OBJECT) && (JS_HAS_FILE_OBJECT - 0)"
|
||||
as the JS_HAS_FILE_OBJECT can be not defined at all (in contrast to
|
||||
other JS_HAS_XXXX defines which are all listed in src/jsconfig.h)
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
o Fix a bunch of compiler warnings.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
o Change from -O2 to -O0 and without -Wshadow under --enable-debug.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
Changes between 1.6.20060730 and 1.6.20060731 (2006-07-30 to 2006-07-31)
|
||||
|
||||
o Fix "make distclean": src/perlconnect/Makefile.PL is always generated
|
||||
and hence has to be always deleted.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
o Fix "devtool dist" command: "make man" does not exist.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
o Fix "make install": the executable "js" was not installed via GNU
|
||||
libtool and this way under --enable-shared the wrapper script was
|
||||
installed only.
|
||||
[Alfred Reibenschuh <alfred.reibenschuh@it-austria.com>]
|
||||
|
||||
o Add a src/perlconnect/MANIFEST file to make ExtUtils::MakeMaker more happy.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
o Fix "make install": js-config.1 was not installed.
|
||||
[Alfred Reibenschuh <alfred.reibenschuh@it-austria.com>]
|
||||
|
||||
o Use Autoconf macros AC_CANONICAL_BUILD and AC_CANONICAL_HOST to
|
||||
make sure that the host identification is really available.
|
||||
[Alfred Reibenschuh <alfred.reibenschuh@it-austria.com>]
|
||||
|
||||
o Upgrade to upstream sources as of 2006-07-31.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
Changes between 1.6.20060729 and 1.6.20060730 (2006-07-29 to 2006-07-30)
|
||||
|
||||
o Add support for Windows CygWin and MinGW environments.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>,
|
||||
Andrew Vajoczki <vajoczki@yahoo.com>]
|
||||
|
||||
o Upgrade to upstream sources as of 2006-07-30.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
Changes between 1.6.20060724 and 1.6.20060729 (2006-07-24 to 2006-07-29)
|
||||
|
||||
o Upgrade to upstream sources as of 2006-07-29.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
o Changed GNU libtool shared library versioning from 0:0 to 1:6.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>,
|
||||
Alfred Reibenschuh <alfred.reibenschuh@it-austria.com>]
|
||||
|
||||
o Increase portability by gracefully downgrading the stat(2) use of
|
||||
st_birthtime to st_birthtimensec or even st_ctime.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>,
|
||||
Andrew Vajoczki <vajoczki@yahoo.com>]
|
||||
|
||||
o Apply a few more upstream fixes to jsfile.c.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
Changes between 1.6.20060722 and 1.6.20060724 (2006-07-22 to 2006-07-24)
|
||||
|
||||
o Apply multiple code cleanups and bugfixes.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
o Move definitions of XP_UNIX and EXPORT_JS_API back from jstypes.h
|
||||
to configure.ac (and this way the command-line) to not break the
|
||||
use of jstypes.h as a regular API header in JS based applications.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
o Consistently mark all OSSP bugfixes with a "/* BUGFIX */" tag on
|
||||
the "#ifdef OSSP" line. This way one can more easily see what
|
||||
are specific OSSP specific changes what should be taken over by
|
||||
upstream vendor.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
o Fix an incorrect argument type bug in jsfile.c related to a call to
|
||||
js_InflateString(). A "size_t *" has to be passed, not a "size_t".
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
o Upgrade from (the Mozilla Firefox 1.5 pinned version) SpiderMonkey
|
||||
1.6.20060722 to the (SPIDERMONKEY_1_6_0_BRANCH based) 1.6.20060724
|
||||
upstream version.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
o Added jslint (see http://www.jslint.com/) together with some
|
||||
home-brewn option parser. The result is installed as
|
||||
a stand-alone "jslint" program.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
o Install all src/js*.h headers during "make install" to allow
|
||||
applications to at least optionally poke around in the internals.
|
||||
This also allows an application to call js_InitFileClass() from
|
||||
<jsfile.h> without us having to really call this function in the
|
||||
standard API function JS_InitStandardClasses().
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
o Change the default of the --with-file/--without from --without-file
|
||||
to --with-file (enable the File object by default), but activate
|
||||
it only in the CLI (where it doesn't hurt and where it is actually
|
||||
really required to get something useful running there in practice)
|
||||
but explicitly _NOT_ in JS_InitStandardClasses() (as this is
|
||||
what would hurt the security in applications which assume that
|
||||
JS_InitStandardClasses() initialized only really the standard
|
||||
classes).
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
||||
Changes between *GENESIS* and 1.6.20060722 (2006-06-XX to 2006-07-22)
|
||||
|
||||
o Initial OSSP js distribution of Mozilla JavaScript 1.6 as of 2006-07-22.
|
||||
[Ralf S. Engelschall <rse@engelschall.com>]
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
_ ___ ____ ____ ____ _
|
||||
|_|_ _ / _ \/ ___/ ___|| _ \ (_)___
|
||||
_|_||_| | | | \___ \___ \| |_) | | / __|
|
||||
|_||_|_| | |_| |___) |__) | __/ | \__ \
|
||||
|_|_|_| \___/|____/____/|_| _/ |___/
|
||||
|__/
|
||||
|
||||
OSSP js - Mozilla JavaScript Engine
|
||||
|
||||
LINKS
|
||||
|
||||
o http://www.mozilla.org/js/
|
||||
o http://www.mozilla.org/js/language/
|
||||
o http://www.mozilla.org/js/spidermonkey/
|
||||
o http://www.ecma-international.org/publications/standards/Ecma-262.htm
|
||||
o http://developer.mozilla.org/en/docs/JavaScript_C_Engine_Embedder's_Guide
|
||||
o http://developer.mozilla.org/en/docs/JSAPI_Reference
|
||||
o http://lxr.mozilla.org/mozilla/source/js/src
|
||||
o http://lxr.mozilla.org/mozilla/source/js/src/README.html
|
||||
o http://www.jibbering.com/faq/
|
||||
o http://www.faqts.com/knowledge_base/index.phtml/fid/53/
|
||||
o http://users.skynet.be/saw/SpiderMonkey.htm
|
||||
o http://groups.google.com/group/mozilla.dev.tech.js-engine
|
||||
o http://groups.google.com/group/netscape.public.mozilla.jseng
|
||||
o http://groups.google.com/group/comp.lang.javascript
|
||||
o http://burstproject.org/build/doc/shells.html
|
||||
o http://developer.mozilla.org/es4/
|
||||
|
|
@ -0,0 +1,228 @@
|
|||
##
|
||||
## OSSP js - JavaScript Engine
|
||||
## Copyright (c) 1998-2006 Mozilla <http://www.mozilla.org/>
|
||||
##
|
||||
## This file is part of OSSP js, a distribution of the Mozilla JavaScript
|
||||
## reference implementation, which can found at http://www.ossp.org/pkg/lib/js/
|
||||
##
|
||||
## Permission to use, copy, modify, and distribute this software for
|
||||
## any purpose with or without fee is hereby granted, provided that
|
||||
## the above copyright notice and this permission notice appear in all
|
||||
## copies.
|
||||
##
|
||||
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
|
||||
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
## SUCH DAMAGE.
|
||||
##
|
||||
## Makefile.in: make(1) build procedure
|
||||
##
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
DESTDIR =
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
datarootdir = @datarootdir@
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
includedir = @includedir@
|
||||
mandir = @mandir@
|
||||
|
||||
CC = @CC@
|
||||
CPPFLAGS = @CPPFLAGS@ @DEFS@ -Isrc
|
||||
CFLAGS = @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
|
||||
CLI_CFLAGS = @CLI_CFLAGS@
|
||||
CLI_CPPFLAGS = @CLI_CPPFLAGS@
|
||||
CLI_LDFLAGS = @CLI_LDFLAGS@
|
||||
CLI_LIBS = @CLI_LIBS@
|
||||
|
||||
RM = rm -f
|
||||
CP = cp
|
||||
RMDIR = rmdir
|
||||
SHTOOL = ./shtool
|
||||
LIBTOOL = ./libtool
|
||||
PERL = @PERL@
|
||||
TRUE = true
|
||||
|
||||
LIB_OBJS = src/jsapi.lo \
|
||||
src/jsarena.lo \
|
||||
src/jsarray.lo \
|
||||
src/jsatom.lo \
|
||||
src/jsbool.lo \
|
||||
src/jscntxt.lo \
|
||||
src/jsdate.lo \
|
||||
src/jsdbgapi.lo \
|
||||
src/jsdhash.lo \
|
||||
src/jsdtoa.lo \
|
||||
src/jsemit.lo \
|
||||
src/jsexn.lo \
|
||||
src/jsfile.lo \
|
||||
src/jsfun.lo \
|
||||
src/jsgc.lo \
|
||||
src/jshash.lo \
|
||||
src/jsinterp.lo \
|
||||
src/jslock.lo \
|
||||
src/jslog2.lo \
|
||||
src/jslong.lo \
|
||||
src/jsmath.lo \
|
||||
src/jsnum.lo \
|
||||
src/jsobj.lo \
|
||||
src/jsopcode.lo \
|
||||
src/jsparse.lo \
|
||||
src/jsprf.lo \
|
||||
src/jsregexp.lo \
|
||||
src/jsscan.lo \
|
||||
src/jsscope.lo \
|
||||
src/jsscript.lo \
|
||||
src/jsstr.lo \
|
||||
src/jsutil.lo \
|
||||
src/jsxdrapi.lo \
|
||||
src/jsxml.lo \
|
||||
src/prmjtime.lo \
|
||||
src/jsdso.lo \
|
||||
src/fdlibm/e_acos.lo \
|
||||
src/fdlibm/e_asin.lo \
|
||||
src/fdlibm/e_atan2.lo \
|
||||
src/fdlibm/e_exp.lo \
|
||||
src/fdlibm/e_fmod.lo \
|
||||
src/fdlibm/e_log.lo \
|
||||
src/fdlibm/e_pow.lo \
|
||||
src/fdlibm/e_rem_pio2.lo \
|
||||
src/fdlibm/s_scalbn.lo \
|
||||
src/fdlibm/e_sqrt.lo \
|
||||
src/fdlibm/k_cos.lo \
|
||||
src/fdlibm/k_sin.lo \
|
||||
src/fdlibm/k_rem_pio2.lo \
|
||||
src/fdlibm/k_tan.lo \
|
||||
src/fdlibm/s_atan.lo \
|
||||
src/fdlibm/s_ceil.lo \
|
||||
src/fdlibm/s_copysign.lo \
|
||||
src/fdlibm/s_cos.lo \
|
||||
src/fdlibm/s_fabs.lo \
|
||||
src/fdlibm/s_finite.lo \
|
||||
src/fdlibm/s_floor.lo \
|
||||
src/fdlibm/s_isnan.lo \
|
||||
src/fdlibm/s_lib_version.lo \
|
||||
src/fdlibm/s_sin.lo \
|
||||
src/fdlibm/s_tan.lo \
|
||||
src/fdlibm/w_acos.lo \
|
||||
src/fdlibm/w_asin.lo \
|
||||
src/fdlibm/w_atan2.lo \
|
||||
src/fdlibm/w_exp.lo \
|
||||
src/fdlibm/w_fmod.lo \
|
||||
src/fdlibm/w_log.lo \
|
||||
src/fdlibm/w_pow.lo \
|
||||
src/fdlibm/w_sqrt.lo
|
||||
LIB_NAME = libjs.la
|
||||
|
||||
CLI_OBJS = src/js.o @CLI_OBJS@
|
||||
CLI_NAME = js
|
||||
|
||||
WITH_PERL = @WITH_PERL@
|
||||
|
||||
TARGETS = $(LIB_NAME) $(CLI_NAME)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .lo
|
||||
|
||||
all: $(TARGETS) subdirs
|
||||
|
||||
subdirs:
|
||||
@if [ ".$(WITH_PERL)" = ".yes" ]; then \
|
||||
(cd src/perlconnect; $(PERL) Makefile.PL; $(MAKE) $(MFLAGS)); \
|
||||
fi
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
.c.lo:
|
||||
@$(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(LIB_NAME): $(LIB_OBJS)
|
||||
@$(LIBTOOL) --mode=link $(CC) -o $(LIB_NAME) $(LIB_OBJS) -rpath $(libdir) -version-info 1:6
|
||||
|
||||
$(CLI_NAME): $(CLI_OBJS) $(LIB_NAME)
|
||||
@$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) $(CLI_LDFLAGS) -o $(CLI_NAME) $(CLI_OBJS) $(LIB_NAME) $(LIBS) $(CLI_LIBS)
|
||||
src/js.o: src/js.c
|
||||
$(CC) $(CPPFLAGS) $(CLI_CPPFLAGS) $(CFLAGS) $(CLI_CFLAGS) -o $@ -c $<
|
||||
src/perlconnect/jsperl.o: src/perlconnect/jsperl.c
|
||||
$(CC) $(CPPFLAGS) $(CLI_CPPFLAGS) $(CFLAGS) $(CLI_CFLAGS) -o $@ -c $<
|
||||
|
||||
$(LIB_OBJS): src/jsautocfg.h
|
||||
src/jsautocfg.h: jscpucfg
|
||||
-rm -f $@ src/jsautocfg.h
|
||||
$(LIBTOOL) --mode=execute ./jscpucfg >src/jsautocfg.h
|
||||
jscpucfg.o: src/jscpucfg.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
|
||||
jscpucfg: jscpucfg.o
|
||||
@$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o jscpucfg jscpucfg.o $(LIBS)
|
||||
src/jsopcode.h src/jsopcode.c: src/jsopcode.tbl
|
||||
|
||||
.PHONY: install
|
||||
install: all
|
||||
$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(prefix)
|
||||
$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(bindir)
|
||||
$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(mandir)/man1
|
||||
$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(mandir)/man3
|
||||
$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(includedir)/js
|
||||
$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(libdir)/pkgconfig
|
||||
$(SHTOOL) install -c -m 644 js.1 $(DESTDIR)$(mandir)/man1/
|
||||
$(SHTOOL) install -c -m 644 js-config.1 $(DESTDIR)$(mandir)/man1/
|
||||
$(SHTOOL) install -c -m 644 js.3 $(DESTDIR)$(mandir)/man3/
|
||||
$(SHTOOL) install -c -m 644 src/js*.h $(DESTDIR)$(includedir)/js/
|
||||
@$(LIBTOOL) --mode=install $(SHTOOL) install -c -m 644 $(LIB_NAME) $(DESTDIR)$(libdir)/
|
||||
$(SHTOOL) install -c -m 644 js.pc $(DESTDIR)$(libdir)/pkgconfig/
|
||||
$(SHTOOL) install -c -m 755 js-config.sh $(DESTDIR)$(bindir)/js-config
|
||||
@$(LIBTOOL) --mode=install $(SHTOOL) install -c -m 755 js $(DESTDIR)$(bindir)/
|
||||
$(SHTOOL) install -e 's;#!\./js;#!$(bindir)/js;' -c -m 755 jslint.js $(DESTDIR)$(bindir)/jslint
|
||||
@if [ ".$(WITH_PERL)" = ".yes" ]; then \
|
||||
(cd src/perlconnect; $(MAKE) $(MFLAGS) install DESTDIR=$(DESTDIR)); \
|
||||
fi
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-$(RM) jscpucfg $(LIB_NAME) $(LIB_OBJS)
|
||||
-$(RM) js src/js.o
|
||||
-$(RM) -r .libs >/dev/null 2>&1 || $(TRUE)
|
||||
-$(RM) -r src/.libs src/fdlibm/.libs >/dev/null 2>&1 || $(TRUE)
|
||||
-$(RM) *.o *.lo
|
||||
@if [ ".$(WITH_PERL)" = ".yes" ]; then \
|
||||
( cd src/perlconnect; \
|
||||
if [ -f Makefile ]; then $(MAKE) $(MFLAGS) clean || $(TRUE); fi; \
|
||||
if [ -f Makefile.old ]; then mv Makefile.old Makefile; fi; \
|
||||
); \
|
||||
fi
|
||||
|
||||
distclean: clean
|
||||
-$(RM) config.log config.status config.cache
|
||||
-$(RM) Makefile config.h js.pc js-config.sh
|
||||
-$(RM) libtool
|
||||
-$(RM) src/perlconnect/Makefile.PL
|
||||
@if [ ".$(WITH_PERL)" = ".yes" ]; then \
|
||||
( cd src/perlconnect; \
|
||||
if [ -f Makefile ]; then $(MAKE) $(MFLAGS) distclean || $(TRUE); fi; \
|
||||
$(RM) -f Makefile Makefile.old || $(TRUE); \
|
||||
); \
|
||||
fi
|
||||
|
||||
realclean: distclean
|
||||
-$(RM) configure config.h.in config.h.in~
|
||||
-$(RM) shtool
|
||||
-$(RM) ltmain.sh libtool.m4 config.guess config.sub
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
_ ___ ____ ____ ____ _
|
||||
|_|_ _ / _ \/ ___/ ___|| _ \ (_)___
|
||||
_|_||_| | | | \___ \___ \| |_) | | / __|
|
||||
|_||_|_| | |_| |___) |__) | __/ | \__ \
|
||||
|_|_|_| \___/|____/____/|_| _/ |___/
|
||||
|__/
|
||||
|
||||
OSSP js - Mozilla JavaScript Engine
|
||||
Version 1.6.20060820 (20-Aug-2006)
|
||||
|
||||
ABSTRACT
|
||||
|
||||
OSSP js is a stand-alone distribution of the JavaScript (JS)
|
||||
programming language reference implementation from Mozilla -- aka
|
||||
"JSRef" or "SpiderMonkey". This distribution provides a smart,
|
||||
stand-alone and portable distribution of Mozilla JavaScript through a
|
||||
build environment based on GNU autoconf, GNU libtool and GNU shtool,
|
||||
including support for easy JavaScript build-time feature set selection
|
||||
(ECMA-3, JS-1.5, JS-1.6), optional CLI line editing support, optional
|
||||
"stdio" based File object support and JS/Perl bindings. Additionally,
|
||||
the C API in "libjs" contains both the JavaScript engine and the
|
||||
required Sun math library ("fdlibm") and with all internal symbols
|
||||
carefully protected under the "js" namespace. Finally, a js-config(1)
|
||||
utility and a pkg-config(1) specification is provided to allow
|
||||
applications to easily build with the JavaScript C API.
|
||||
|
||||
JUSTIFICATION
|
||||
|
||||
OSSP js was created because for OSSP and similar pedantic C coding
|
||||
projects a smart, stand-alone, portable, clean, powerful and
|
||||
robust scripting language engine is required. JavaScript is a
|
||||
great programming language and Mozilla JavaScript "SpiderMonkey"
|
||||
definitely is an acceptable clean, powerful and robust implementation.
|
||||
Unfortunately there is just a stand-alone distribution released from
|
||||
time to time by Mozilla and it is far away from really being smart,
|
||||
stand-alone and portable. At least for OSSP it was not acceptable
|
||||
having to tell the community that for small and stand-alone C
|
||||
components like the OSSP components they either have to install the
|
||||
great but large Mozilla Firefox application (where Mozilla JavaScript
|
||||
is included) or have to fiddle around theirself with an older
|
||||
stand-alone JavaScript distribution and its weak build environment.
|
||||
OSSP js combines the best from two worlds: the 1:1 repackaged
|
||||
JavaScript code base from Mozilla and the usual amount of GNU
|
||||
autoconf, GNU libtool and GNU shtool wrappers as always used by OSSP.
|
||||
Additionally, stand-alone ("stdio" instead of NSPR based) File object
|
||||
support was required.
|
||||
|
||||
VERSIONING
|
||||
|
||||
The version of OSSP js is M.N.YYYYMMDD where M.N is the JavaScript
|
||||
branch and YYYYMMDD is the date where the JavaScript code was
|
||||
extracted from the Mozilla CVS repository.
|
||||
|
||||
COPYRIGHT AND LICENSE
|
||||
|
||||
Copyright (c) 1998-2006 Mozilla <http://www.mozilla.org/>
|
||||
|
||||
This file is part of OSSP js, a repackaging of the Mozilla JavaScript
|
||||
reference implementation, which can found at http://www.ossp.org/pkg/lib/js/
|
||||
|
||||
The content of this distribution is licensed under the Mozilla
|
||||
Public License (MPL) 1.1 (see http://www.mozilla.org/MPL/) or
|
||||
alternatively the GNU General Public License (GPL) 2.0 (see
|
||||
http://www.gnu.org/licenses/gpl.html) or the GNU Lesser General Public
|
||||
License (LGPL) 2.1 (see http://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
HOME
|
||||
|
||||
The latest release can be found on
|
||||
|
||||
o http://www.ossp.org/pkg/lib/js/
|
||||
o ftp://ftp.ossp.org/pkg/lib/js/
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
_ ___ ____ ____ ____ _
|
||||
|_|_ _ / _ \/ ___/ ___|| _ \ (_)___
|
||||
_|_||_| | | | \___ \___ \| |_) | | / __|
|
||||
|_||_|_| | |_| |___) |__) | __/ | \__ \
|
||||
|_|_|_| \___/|____/____/|_| _/ |___/
|
||||
|__/
|
||||
|
||||
OSSP js - Mozilla JavaScript Engine
|
||||
|
||||
THANKS
|
||||
|
||||
Credit has to be given to the following people who contributed ideas,
|
||||
bugfixes, hints, gave platform feedback, etc. (in alphabetical order):
|
||||
|
||||
o Thomas Lotterer <thomas@lotterer.net>
|
||||
o Alfred Reibenschuh <alfred.reibenschuh@it-austria.com>
|
||||
o Andrew Vajoczki <vajoczki@yahoo.com>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
_ ___ ____ ____ ____ _
|
||||
|_|_ _ / _ \/ ___/ ___|| _ \ (_)___
|
||||
_|_||_| | | | \___ \___ \| |_) | | / __|
|
||||
|_||_|_| | |_| |___) |__) | __/ | \__ \
|
||||
|_|_|_| \___/|____/____/|_| _/ |___/
|
||||
|__/
|
||||
|
||||
OSSP js - Mozilla JavaScript Engine
|
||||
|
||||
TODO
|
||||
|
||||
- nothing known at this point.
|
||||
|
||||
CANDO
|
||||
|
||||
- nothing known at this point.
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
VERSION -- Version Information for OSSP js (syntax: Text)
|
||||
[automatically generated and maintained by GNU shtool]
|
||||
|
||||
This is OSSP js, Version 1.6.20060820 (20-Aug-2006)
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
dnl ##
|
||||
dnl ## SA - OSSP Socket Abstraction Library
|
||||
dnl ## Copyright (c) 2001-2003 Ralf S. Engelschall <rse@engelschall.com>
|
||||
dnl ## Copyright (c) 2001-2003 The OSSP Project <http://www.ossp.org/>
|
||||
dnl ## Copyright (c) 2001-2003 Cable & Wireless Deutschland <http://www.cw.com/de/>
|
||||
dnl ##
|
||||
dnl ## This file is part of OSSP SA, a socket abstraction library which
|
||||
dnl ## can be found at http://www.ossp.org/pkg/sa/.
|
||||
dnl ##
|
||||
dnl ## Permission to use, copy, modify, and distribute this software for
|
||||
dnl ## any purpose with or without fee is hereby granted, provided that
|
||||
dnl ## the above copyright notice and this permission notice appear in all
|
||||
dnl ## copies.
|
||||
dnl ##
|
||||
dnl ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
dnl ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
dnl ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
dnl ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
|
||||
dnl ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
dnl ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
dnl ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
dnl ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
dnl ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
dnl ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
dnl ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
dnl ## SUCH DAMAGE.
|
||||
dnl ##
|
||||
dnl ## aclocal.m4: GNU Autoconf local macro definitions
|
||||
dnl ##
|
||||
|
||||
dnl ##
|
||||
dnl ## Check whether compiler option works
|
||||
dnl ##
|
||||
dnl ## configure.in:
|
||||
dnl ## AC_COMPILER_OPTION(<name>, <display>, <option>,
|
||||
dnl ## <action-success>, <action-failure>)
|
||||
dnl ##
|
||||
|
||||
AC_DEFUN(AC_COMPILER_OPTION,[dnl
|
||||
AC_MSG_CHECKING(whether compiler option(s) $2 work)
|
||||
AC_CACHE_VAL(ac_cv_compiler_option_$1,[
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $3"
|
||||
AC_TRY_COMPILE([],[], ac_cv_compiler_option_$1=yes, ac_cv_compiler_option_$1=no)
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
])dnl
|
||||
if test ".$ac_cv_compiler_option_$1" = .yes; then
|
||||
ifelse([$4], , :, [$4])
|
||||
else
|
||||
ifelse([$5], , :, [$5])
|
||||
fi
|
||||
AC_MSG_RESULT([$ac_cv_compiler_option_$1])
|
||||
])dnl
|
||||
|
||||
dnl ##
|
||||
dnl ## Debugging Support
|
||||
dnl ##
|
||||
dnl ## configure.in:
|
||||
dnl ## AC_CHECK_DEBUGGING
|
||||
dnl ##
|
||||
|
||||
AC_DEFUN(AC_CHECK_DEBUGGING,[dnl
|
||||
AC_ARG_ENABLE(debug,dnl
|
||||
[ --enable-debug build for debugging (default=no)],
|
||||
[dnl
|
||||
if test ".$ac_cv_prog_gcc" = ".yes"; then
|
||||
case "$CFLAGS" in
|
||||
*-O* ) ;;
|
||||
* ) CFLAGS="$CFLAGS -O0" ;;
|
||||
esac
|
||||
case "$CFLAGS" in
|
||||
*-g* ) ;;
|
||||
* ) CFLAGS="$CFLAGS -g" ;;
|
||||
esac
|
||||
case "$CFLAGS" in
|
||||
*-pipe* ) ;;
|
||||
* ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CFLAGS="$CFLAGS -pipe") ;;
|
||||
esac
|
||||
AC_COMPILER_OPTION(defdbg, -DDEBUG, -DDEBUG, CFLAGS="$CFLAGS -DDEBUG")
|
||||
CFLAGS="$CFLAGS -pedantic"
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
WMORE="-Wpointer-arith -Wcast-align -Winline"
|
||||
WMORE="$WMORE -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
|
||||
AC_COMPILER_OPTION(wmore, -W<xxx>, $WMORE, CFLAGS="$CFLAGS $WMORE")
|
||||
AC_COMPILER_OPTION(wnolonglong, -Wno-long-long, -Wno-long-long, CFLAGS="$CFLAGS -Wno-long-long")
|
||||
else
|
||||
case "$CFLAGS" in
|
||||
*-g* ) ;;
|
||||
* ) CFLAGS="$CFLAGS -g" ;;
|
||||
esac
|
||||
fi
|
||||
msg="enabled"
|
||||
],[
|
||||
AC_COMPILER_OPTION(defnodbg, -DNDEBUG, -DNDEBUG, CFLAGS="$CFLAGS -DNDEBUG")
|
||||
if test ".$ac_cv_prog_gcc" = ".yes"; then
|
||||
case "$CFLAGS" in
|
||||
*-pipe* ) ;;
|
||||
* ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CFLAGS="$CFLAGS -pipe") ;;
|
||||
esac
|
||||
fi
|
||||
case "$CFLAGS" in
|
||||
*-g* ) CFLAGS=`echo "$CFLAGS" |\
|
||||
sed -e 's/ -g / /g' -e 's/ -g$//' -e 's/^-g //g' -e 's/^-g$//'` ;;
|
||||
esac
|
||||
case "$CXXFLAGS" in
|
||||
*-g* ) CXXFLAGS=`echo "$CXXFLAGS" |\
|
||||
sed -e 's/ -g / /g' -e 's/ -g$//' -e 's/^-g //g' -e 's/^-g$//'` ;;
|
||||
esac
|
||||
msg=disabled
|
||||
])dnl
|
||||
AC_MSG_CHECKING(for compilation debug mode)
|
||||
AC_MSG_RESULT([$msg])
|
||||
if test ".$msg" = .enabled; then
|
||||
enable_shared=no
|
||||
fi
|
||||
])
|
||||
|
||||
dnl ##
|
||||
dnl ## Check for C99 va_copy() implementation
|
||||
dnl ## (and provide fallback implementation if neccessary)
|
||||
dnl ##
|
||||
dnl ## configure.in:
|
||||
dnl ## AC_CHECK_VA_COPY
|
||||
dnl ## foo.c:
|
||||
dnl ## #include "config.h"
|
||||
dnl ## [...]
|
||||
dnl ## va_copy(d,s)
|
||||
dnl ##
|
||||
dnl ## This check is rather complex: first because we really have to
|
||||
dnl ## try various possible implementations in sequence and second, we
|
||||
dnl ## cannot define a macro in config.h with parameters directly.
|
||||
dnl ##
|
||||
|
||||
dnl # test program for va_copy() implementation
|
||||
changequote(<<,>>)
|
||||
m4_define(__va_copy_test, <<[
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#define DO_VA_COPY(d, s) $1
|
||||
void test(char *str, ...)
|
||||
{
|
||||
va_list ap, ap2;
|
||||
int i;
|
||||
va_start(ap, str);
|
||||
DO_VA_COPY(ap2, ap);
|
||||
for (i = 1; i <= 9; i++) {
|
||||
int k = (int)va_arg(ap, int);
|
||||
if (k != i)
|
||||
abort();
|
||||
}
|
||||
DO_VA_COPY(ap, ap2);
|
||||
for (i = 1; i <= 9; i++) {
|
||||
int k = (int)va_arg(ap, int);
|
||||
if (k != i)
|
||||
abort();
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
test("test", 1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
exit(0);
|
||||
}
|
||||
]>>)
|
||||
changequote([,])
|
||||
|
||||
dnl # test driver for va_copy() implementation
|
||||
m4_define(__va_copy_check, [
|
||||
AH_VERBATIM($1,
|
||||
[/* Predefined possible va_copy() implementation (id: $1) */
|
||||
#define __VA_COPY_USE_$1(d, s) $2])
|
||||
if test ".$ac_cv_va_copy" = .; then
|
||||
AC_TRY_RUN(__va_copy_test($2), [ac_cv_va_copy="$1"])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl # Autoconf check for va_copy() implementation checking
|
||||
AC_DEFUN(AC_CHECK_VA_COPY,[
|
||||
dnl # provide Autoconf display check message
|
||||
AC_MSG_CHECKING(for va_copy() function)
|
||||
dnl # check for various implementations in priorized sequence
|
||||
AC_CACHE_VAL(ac_cv_va_copy, [
|
||||
ac_cv_va_copy=""
|
||||
dnl # 1. check for standardized C99 macro
|
||||
__va_copy_check(C99, [va_copy((d), (s))])
|
||||
dnl # 2. check for alternative/deprecated GCC macro
|
||||
__va_copy_check(GCM, [VA_COPY((d), (s))])
|
||||
dnl # 3. check for internal GCC macro (high-level define)
|
||||
__va_copy_check(GCH, [__va_copy((d), (s))])
|
||||
dnl # 4. check for internal GCC macro (built-in function)
|
||||
__va_copy_check(GCB, [__builtin_va_copy((d), (s))])
|
||||
dnl # 5. check for assignment approach (assuming va_list is a struct)
|
||||
__va_copy_check(ASS, [do { (d) = (s); } while (0)])
|
||||
dnl # 6. check for assignment approach (assuming va_list is a pointer)
|
||||
__va_copy_check(ASP, [do { *(d) = *(s); } while (0)])
|
||||
dnl # 7. check for memory copying approach (assuming va_list is a struct)
|
||||
__va_copy_check(CPS, [memcpy((void *)&(d), (void *)&(s)), sizeof((s))])
|
||||
dnl # 8. check for memory copying approach (assuming va_list is a pointer)
|
||||
__va_copy_check(CPP, [memcpy((void *)(d), (void *)(s)), sizeof(*(s))])
|
||||
if test ".$ac_cv_va_copy" = .; then
|
||||
AC_ERROR([no working implementation found])
|
||||
fi
|
||||
])
|
||||
dnl # optionally activate the fallback implementation
|
||||
if test ".$ac_cv_va_copy" = ".C99"; then
|
||||
AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy() macro exists (and no fallback implementation is required)])
|
||||
fi
|
||||
dnl # declare which fallback implementation to actually use
|
||||
AC_DEFINE_UNQUOTED([__VA_COPY_USE], [__VA_COPY_USE_$ac_cv_va_copy],
|
||||
[Define to id of used va_copy() implementation])
|
||||
dnl # provide activation hook for fallback implementation
|
||||
AH_VERBATIM([__VA_COPY_ACTIVATION],
|
||||
[/* Optional va_copy() implementation activation */
|
||||
#ifndef HAVE_VA_COPY
|
||||
#define va_copy(d, s) __VA_COPY_USE(d, s)
|
||||
#endif
|
||||
])
|
||||
dnl # provide Autoconf display result message
|
||||
if test ".$ac_cv_va_copy" = ".C99"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no (using fallback implementation)])
|
||||
fi
|
||||
])
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,113 @@
|
|||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Predefined possible va_copy() implementation (id: ASP) */
|
||||
#define __VA_COPY_USE_ASP(d, s) do { *(d) = *(s); } while (0)
|
||||
|
||||
/* Predefined possible va_copy() implementation (id: ASS) */
|
||||
#define __VA_COPY_USE_ASS(d, s) do { (d) = (s); } while (0)
|
||||
|
||||
/* Predefined possible va_copy() implementation (id: C99) */
|
||||
#define __VA_COPY_USE_C99(d, s) va_copy((d), (s))
|
||||
|
||||
/* Predefined possible va_copy() implementation (id: CPP) */
|
||||
#define __VA_COPY_USE_CPP(d, s) memcpy((void *)(d), (void *)(s)), sizeof(*(s))
|
||||
|
||||
/* Predefined possible va_copy() implementation (id: CPS) */
|
||||
#define __VA_COPY_USE_CPS(d, s) memcpy((void *)&(d), (void *)&(s)), sizeof((s))
|
||||
|
||||
/* Predefined possible va_copy() implementation (id: GCB) */
|
||||
#define __VA_COPY_USE_GCB(d, s) __builtin_va_copy((d), (s))
|
||||
|
||||
/* Predefined possible va_copy() implementation (id: GCH) */
|
||||
#define __VA_COPY_USE_GCH(d, s) __va_copy((d), (s))
|
||||
|
||||
/* Predefined possible va_copy() implementation (id: GCM) */
|
||||
#define __VA_COPY_USE_GCM(d, s) VA_COPY((d), (s))
|
||||
|
||||
/* Define to 1 if you have the `dlclose' function. */
|
||||
#undef HAVE_DLCLOSE
|
||||
|
||||
/* Define to 1 if you have the `dlerror' function. */
|
||||
#undef HAVE_DLERROR
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `dlopen' function. */
|
||||
#undef HAVE_DLOPEN
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `dl' library (-ldl). */
|
||||
#undef HAVE_LIBDL
|
||||
|
||||
/* Define to 1 if you have the `m' library (-lm). */
|
||||
#undef HAVE_LIBM
|
||||
|
||||
/* Define to 1 if you have the `nsl' library (-lnsl). */
|
||||
#undef HAVE_LIBNSL
|
||||
|
||||
/* Define to 1 if you have the `socket' library (-lsocket). */
|
||||
#undef HAVE_LIBSOCKET
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if `st_birthtime' is member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_BIRTHTIME
|
||||
|
||||
/* Define to 1 if `st_birthtimensec' is member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if va_copy() macro exists (and no fallback implementation is
|
||||
required) */
|
||||
#undef HAVE_VA_COPY
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Optional va_copy() implementation activation */
|
||||
#ifndef HAVE_VA_COPY
|
||||
#define va_copy(d, s) __VA_COPY_USE(d, s)
|
||||
#endif
|
||||
|
||||
|
||||
/* Define to id of used va_copy() implementation */
|
||||
#undef __VA_COPY_USE
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,176 @@
|
|||
dnl ##
|
||||
dnl ## OSSP js - JavaScript Engine
|
||||
dnl ## Copyright (c) 1998-2006 Mozilla <http://www.mozilla.org/>
|
||||
dnl ##
|
||||
dnl ## This file is part of OSSP js, a distribution of the Mozilla JavaScript
|
||||
dnl ## reference implementation, which can found at http://www.ossp.org/pkg/lib/js/
|
||||
dnl ##
|
||||
dnl ## Permission to use, copy, modify, and distribute this software for
|
||||
dnl ## any purpose with or without fee is hereby granted, provided that
|
||||
dnl ## the above copyright notice and this permission notice appear in all
|
||||
dnl ## copies.
|
||||
dnl ##
|
||||
dnl ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
dnl ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
dnl ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
dnl ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
|
||||
dnl ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
dnl ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
dnl ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
dnl ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
dnl ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
dnl ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
dnl ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
dnl ## SUCH DAMAGE.
|
||||
dnl ##
|
||||
dnl ## configure.ac: GNU Autoconf source script
|
||||
dnl ##
|
||||
|
||||
AC_PREREQ(2.60)
|
||||
AC_INIT
|
||||
JS_VERSION=`./shtool version -l txt -d short VERSION`
|
||||
$ac_confdir/shtool echo -e \
|
||||
"Configuring %BOSSP js%b (Mozilla JavaScript Engine), version %B${JS_VERSION}%b"
|
||||
AC_SUBST(JS_VERSION)
|
||||
|
||||
AC_CANONICAL_BUILD
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_CC
|
||||
AC_CHECK_DEBUGGING
|
||||
AC_CHECK_VA_COPY
|
||||
|
||||
AC_CHECK_LIB(nsl, gethostname)
|
||||
if test ".`echo $LIBS | grep nsl`" = .; then
|
||||
AC_CHECK_LIB(nsl, gethostbyname)
|
||||
fi
|
||||
AC_CHECK_LIB(socket, accept)
|
||||
AC_CHECK_LIB(m, floor)
|
||||
|
||||
AC_CHECK_MEMBERS([struct stat.st_birthtime, struct stat.st_birthtimensec],,, [#include <sys/stat.h>])
|
||||
|
||||
CPPFLAGS="$CPPFLAGS -DOSSP"
|
||||
case "${host}" in
|
||||
*mingw* | *windows* | *winnt* ) CPPFLAGS="$CPPFLAGS -DXP_WIN" ;;
|
||||
* ) CPPFLAGS="$CPPFLAGS -DXP_UNIX" ;;
|
||||
esac
|
||||
CPPFLAGS="$CPPFLAGS -DEXPORT_JS_API"
|
||||
|
||||
dnl # configure option --with-version
|
||||
AC_ARG_WITH([version],
|
||||
AC_HELP_STRING([--with-version], [build the run-time engine with JavaScript features only. Available versions are: ECMA-3, JS-1.5, JS-1.6 (default)]),
|
||||
[ac_cv_with_version=$withval], [ac_cv_with_version=no])
|
||||
AC_CACHE_CHECK([whether to build the run-time engine with JavaScript features only],
|
||||
[ac_cv_with_version], [ac_cv_with_version=no])
|
||||
case "$ac_cv_with_version" in
|
||||
dnl JS-1.0 ) CPPFLAGS="$CPPFLAGS -DJS_VERSION=100" ;;
|
||||
dnl JS-1.1 ) CPPFLAGS="$CPPFLAGS -DJS_VERSION=110" ;;
|
||||
dnl JS-1.2 ) CPPFLAGS="$CPPFLAGS -DJS_VERSION=120" ;;
|
||||
dnl JS-1.3 ) CPPFLAGS="$CPPFLAGS -DJS_VERSION=130" ;;
|
||||
dnl JS-1.4 ) CPPFLAGS="$CPPFLAGS -DJS_VERSION=140" ;;
|
||||
ECMA-3 ) CPPFLAGS="$CPPFLAGS -DJS_VERSION=148" ;;
|
||||
JS-1.5 ) CPPFLAGS="$CPPFLAGS -DJS_VERSION=150" ;;
|
||||
JS-1.6 ) CPPFLAGS="$CPPFLAGS -DJS_VERSION=160" ;;
|
||||
esac
|
||||
|
||||
CLI_CPPFLAGS=""
|
||||
CLI_CFLAGS=""
|
||||
CLI_LDFLAGS=""
|
||||
CLI_LIBS=""
|
||||
CLI_OBJS=""
|
||||
|
||||
dnl # configure option --with-editline[=path]
|
||||
AC_ARG_WITH([editline],
|
||||
AC_HELP_STRING([--with-editline], [build command line interface with line editing support via editline, libedit or GNU readline]),
|
||||
[ac_cv_with_editline=$withval], [ac_cv_with_editline=no])
|
||||
AC_CACHE_CHECK([whether to build command line interface with line editing support],
|
||||
[ac_cv_with_editline], [ac_cv_with_editline=no])
|
||||
if test ".$ac_cv_with_editline" != ".no"; then
|
||||
CLI_CPPFLAGS="$CLI_CPPFLAGS -DEDITLINE"
|
||||
case "$ac_cv_with_editline" in
|
||||
/* ) CLI_LDFLAGS="-L$ac_cv_with_editline" ;;
|
||||
esac
|
||||
OLD_LDFLAGS="$LDFLAGS";
|
||||
OLD_LIBS="$LIBS";
|
||||
LDFLAGS="$LDFLAGS $CLI_LDFLAGS"
|
||||
LIBS=""
|
||||
AC_SEARCH_LIBS(tcgetattr, termcap termlib curses ncurses)
|
||||
AC_SEARCH_LIBS(tputs, termcap termlib curses ncurses)
|
||||
TERM_LIBS="$LIBS"
|
||||
AC_SEARCH_LIBS(readline, editline edit readline,,, [$TERM_LIBS])
|
||||
CLI_LIBS="$LIBS"
|
||||
LDFLAGS="$OLD_LDFLAGS"
|
||||
LIBS="$OLD_LIBS"
|
||||
fi
|
||||
|
||||
dnl # configure option --with-perl
|
||||
AC_ARG_WITH([perl],
|
||||
AS_HELP_STRING([--with-perl], [build Perl-to-JS and JS-to-Perl bindings]),
|
||||
[ac_cv_with_perl=$withval], [ac_cv_with_perl=no])
|
||||
AC_CACHE_CHECK([whether to build Perl-to-JS and JS-to-Perl bindings], [ac_cv_with_perl], [ac_cv_with_perl=no])
|
||||
if test ".$ac_cv_with_perl" != ".no"; then
|
||||
WITH_PERL="yes"
|
||||
CLI_OBJS="$CLI_OBJS src/perlconnect/jsperl.o"
|
||||
CLI_CPPFLAGS="$CLI_CPPFLAGS -DPERLCONNECT"
|
||||
else
|
||||
WITH_PERL="no"
|
||||
fi
|
||||
AC_SUBST(WITH_PERL)
|
||||
case "$ac_cv_with_perl" in
|
||||
/* ) PERL="$ac_cv_with_perl" ;;
|
||||
esac
|
||||
AC_PATH_PROG(PERL, perl, NA)
|
||||
if test ".$ac_cv_with_perl" = ".yes" -a ".$PERL" = ".NA"; then
|
||||
AC_ERROR([required Perl interpreter not found in \$PATH])
|
||||
fi
|
||||
if test ".$ac_cv_with_perl" != ".no"; then
|
||||
CLI_CFLAGS="$CLI_CFLAGS `$PERL -MExtUtils::Embed -e ccopts`"
|
||||
CLI_LIBS="$CLI_LIBS `$PERL -MExtUtils::Embed -e ldopts`"
|
||||
fi
|
||||
|
||||
dnl # configure option --without-file
|
||||
AC_ARG_WITH([file],
|
||||
AS_HELP_STRING([--without-file], [build without File object (grants access to the filesystem)]),
|
||||
[ac_cv_with_file=$withval], [ac_cv_with_file=yes])
|
||||
AC_CACHE_CHECK([whether to build with the File object], [ac_cv_with_file], [ac_cv_with_file=yes])
|
||||
if test ".$ac_cv_with_file" = ".yes"; then
|
||||
CPPFLAGS="$CPPFLAGS -DJS_HAS_FILE_OBJECT"
|
||||
fi
|
||||
|
||||
dnl # configure option --with-dso
|
||||
AC_ARG_WITH([dso],
|
||||
AS_HELP_STRING([--with-dso], [build without DSO object (allows run-time process extending)]),
|
||||
[ac_cv_with_dso=$withval], [ac_cv_with_dso=no])
|
||||
AC_CACHE_CHECK([whether to build with the DSO object], [ac_cv_with_dso], [ac_cv_with_dso=no])
|
||||
if test ".$ac_cv_with_dso" = ".yes"; then
|
||||
AC_CHECK_LIB(dl, dlopen)
|
||||
AC_CHECK_HEADER(dlfcn.h, , AC_ERROR([dlopen(3) header <dlfcn.h> required]))
|
||||
AC_CHECK_FUNCS(dlopen dlclose dlerror, , AC_ERROR([dlopen(3) API functions dlopen/dlclose/dlerror required]))
|
||||
CPPFLAGS="$CPPFLAGS -DJS_HAS_DSO_OBJECT"
|
||||
CLI_LDFLAGS="$CLI_LDFLAGS -export-dynamic"
|
||||
fi
|
||||
|
||||
dnl # configure option --with-utf8
|
||||
AC_ARG_WITH([utf8],
|
||||
AS_HELP_STRING([--with-utf8], [build with exclusive UTF-8 C strings (uses Unicode UTF-8 encoded C strings only)]),
|
||||
[ac_cv_with_utf8=$withval], [ac_cv_with_utf8=no])
|
||||
AC_CACHE_CHECK([whether to build with exclusive UTF-8 C string], [ac_cv_with_utf8], [ac_cv_with_utf8=no])
|
||||
if test ".$ac_cv_with_utf8" = ".yes"; then
|
||||
CPPFLAGS="$CPPFLAGS -DJS_C_STRINGS_ARE_UTF8"
|
||||
fi
|
||||
|
||||
AC_SUBST(CLI_CFLAGS)
|
||||
AC_SUBST(CLI_CPPFLAGS)
|
||||
AC_SUBST(CLI_LDFLAGS)
|
||||
AC_SUBST(CLI_LIBS)
|
||||
AC_SUBST(CLI_OBJS)
|
||||
|
||||
with_tags=""
|
||||
sinclude(libtool.m4)
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
AC_CONFIG_FILES([Makefile js.pc js-config.sh src/perlconnect/Makefile.PL])
|
||||
AC_OUTPUT
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
.TH JS-CONFIG 1 "22 July 2006"
|
||||
.SH NAME
|
||||
.BR js-config " - Mozilla JavaScript C API Configuration Query Utility"
|
||||
.SH SYNOPSIS
|
||||
.B js-config
|
||||
.RB [ --help ]
|
||||
.RB [ --version ]
|
||||
.RB [ --prefix ]
|
||||
.RB [ --exec-prefix ]
|
||||
.RB [ --bindir ]
|
||||
.RB [ --libdir ]
|
||||
.RB [ --includedir ]
|
||||
.RB [ --mandir ]
|
||||
.RB [ --datadir ]
|
||||
.RB [ --acdir ]
|
||||
.RB [ --cppflags ]
|
||||
.RB [ --cflags ]
|
||||
.RB [ --ldflags ]
|
||||
.RB [ --libs ]
|
||||
.SH DESCRIPTION
|
||||
The Mozilla JavaScript C API Configuration Query Utility
|
||||
.B js-config
|
||||
is a command line utility
|
||||
for querying various build-time parameters when
|
||||
linking the
|
||||
.B Mozilla JavaScript
|
||||
language engine ("SpiderMonkey"),
|
||||
as provided by the
|
||||
.B OSSP js
|
||||
distribution, into own applications.
|
||||
.PP
|
||||
For platforms where
|
||||
.BR pkg-config ( 1 )
|
||||
is available one can use this as an alternative, too.
|
||||
The advantage of
|
||||
.BR js-config ( 1 )
|
||||
is that it is a stand-alone shell script without
|
||||
any dependencies and already ships with the
|
||||
.B OSSP js
|
||||
distribution.
|
||||
.SH EXAMPLES
|
||||
.RS 0
|
||||
cc `js-config --cppflags` -o foo foo.c `js-config --ldflags --libs`
|
||||
.RE
|
||||
.SH SEE ALSO
|
||||
.BR js ( 1 ),
|
||||
.BR js ( 3 )
|
||||
.PP
|
||||
.RS 0
|
||||
http://www.mozilla.org/js/spidermonkey/
|
||||
.RE
|
||||
.RS 0
|
||||
http://www.ossp.org/pkg/lib/js/
|
||||
.RE
|
||||
.SH AUTHOR
|
||||
The author of the
|
||||
.B Mozilla JavaScript
|
||||
language implementation ("SpiderMonkey") is
|
||||
.I Brendan Eich
|
||||
from the
|
||||
.IR "Mozilla Foundation" .
|
||||
This manual page was written by
|
||||
.I Ralf S. Engelschall
|
||||
for the
|
||||
.B OSSP js
|
||||
distribution of
|
||||
.BR "Mozilla JavaScript" .
|
|
@ -0,0 +1,138 @@
|
|||
#!/bin/sh
|
||||
##
|
||||
## OSSP js - JavaScript Engine
|
||||
## Copyright (c) 1998-2006 Mozilla <http://www.mozilla.org/>
|
||||
##
|
||||
## This file is part of OSSP js, a distribution of the Mozilla JavaScript
|
||||
## reference implementation, which can found at http://www.ossp.org/pkg/lib/js/
|
||||
##
|
||||
## Permission to use, copy, modify, and distribute this software for
|
||||
## any purpose with or without fee is hereby granted, provided that
|
||||
## the above copyright notice and this permission notice appear in all
|
||||
## copies.
|
||||
##
|
||||
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
|
||||
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
## SUCH DAMAGE.
|
||||
##
|
||||
## js-config.in: library build utility
|
||||
##
|
||||
|
||||
DIFS='
|
||||
'
|
||||
|
||||
prefix="@prefix@"
|
||||
exec_prefix="@exec_prefix@"
|
||||
|
||||
js_prefix="$prefix"
|
||||
js_exec_prefix="$exec_prefix"
|
||||
js_datarootdir="@datarootdir@"
|
||||
js_bindir="@bindir@"
|
||||
js_libdir="@libdir@"
|
||||
js_includedir="@includedir@"
|
||||
js_mandir="@mandir@"
|
||||
js_datadir="@datadir@"
|
||||
js_acdir="@datadir@/aclocal"
|
||||
js_libs="@LIBS@"
|
||||
js_version="@JS_VERSION@"
|
||||
|
||||
help=no
|
||||
version=no
|
||||
|
||||
usage="js-config"
|
||||
usage="$usage [--help] [--version]"
|
||||
usage="$usage [--prefix] [--exec-prefix] [--bindir] [--libdir] [--includedir] [--mandir] [--datadir] [--acdir]"
|
||||
usage="$usage [--cppflags] [--cflags] [--ldflags] [--libs]"
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "js-config:Error: Invalid option" 1>&2
|
||||
echo "js-config:Usage: $usage" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
output=''
|
||||
all=no
|
||||
prev=''
|
||||
OIFS="$IFS" IFS="$DIFS"
|
||||
for option
|
||||
do
|
||||
if [ ".$prev" != . ]; then
|
||||
eval "$prev=\$option"
|
||||
prev=''
|
||||
continue
|
||||
fi
|
||||
case "$option" in
|
||||
-*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg='' ;;
|
||||
esac
|
||||
case "$option" in
|
||||
--help|-h)
|
||||
echo "Usage: $usage"
|
||||
exit 0
|
||||
;;
|
||||
--version|-v)
|
||||
echo "OSSP js $js_version"
|
||||
exit 0
|
||||
;;
|
||||
--all)
|
||||
all=yes
|
||||
;;
|
||||
--prefix)
|
||||
output="$output $js_prefix"
|
||||
;;
|
||||
--exec-prefix)
|
||||
output="$output $js_exec_prefix"
|
||||
;;
|
||||
--bindir)
|
||||
output="$output $js_bindir"
|
||||
;;
|
||||
--libdir)
|
||||
output="$output $js_libdir"
|
||||
;;
|
||||
--includedir)
|
||||
output="$output $js_includedir"
|
||||
;;
|
||||
--mandir)
|
||||
output="$output $js_mandir"
|
||||
;;
|
||||
--datadir)
|
||||
output="$output $js_datadir"
|
||||
;;
|
||||
--acdir)
|
||||
output="$output $js_acdir"
|
||||
;;
|
||||
--cppflags)
|
||||
output="$output -DOSSP -DXP_UNIX -I$js_includedir/js"
|
||||
;;
|
||||
--cflags)
|
||||
: # none
|
||||
;;
|
||||
--ldflags)
|
||||
output="$output -L$js_libdir"
|
||||
;;
|
||||
--libs)
|
||||
output="$output -ljs $js_libs"
|
||||
;;
|
||||
* )
|
||||
echo "js-config:Error: Invalid option" 1>&2
|
||||
echo "js-config:Usage: $usage" 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
done
|
||||
IFS="$OIFS"
|
||||
if [ ".$prev" != . ]; then
|
||||
echo "js-config:Error: missing argument to --`echo $prev | sed 's/_/-/g'`" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
if [ ".$output" != . ]; then
|
||||
echo $output
|
||||
fi
|
||||
|
|
@ -0,0 +1,167 @@
|
|||
.TH JS 1 "22 July 2006"
|
||||
.SH NAME
|
||||
.BR js " - Mozilla JavaScript Shell"
|
||||
.SH SYNOPSIS
|
||||
.B js
|
||||
.RB [ -w ]
|
||||
.RB [ -W ]
|
||||
.RB [ -S ]
|
||||
.RB [ -x ]
|
||||
.RB [ -C ]
|
||||
.RB [ -c
|
||||
.IR stackchunksize ]
|
||||
.RB [ -S
|
||||
.IR maxstacksize ]
|
||||
.RB [ -b
|
||||
.IR maxbranches ]
|
||||
.RB [ -P ]
|
||||
.RB [ -v
|
||||
.IR version ]
|
||||
.RB [ -e
|
||||
.IR script ]
|
||||
.RB [ -f
|
||||
.IR scriptfile ]
|
||||
.RI [ scriptfile ]
|
||||
.RI [ scriptarg " ..." "" ]
|
||||
.SH DESCRIPTION
|
||||
The Mozilla JavaScript Shell
|
||||
.B js
|
||||
is a command line interface to the
|
||||
.B Mozilla JavaScript
|
||||
language engine ("SpiderMonkey"),
|
||||
as provided by the
|
||||
.B OSSP js
|
||||
distribution.
|
||||
The
|
||||
.B js
|
||||
program provides a test vehicle for easily evaluating JavaScript scripts, calling JavaScript functions,
|
||||
trying out debugger primitives, etc.
|
||||
.SH OPTIONS
|
||||
.SS Compile-Time Options
|
||||
.TP 8
|
||||
.B -w
|
||||
Disable the printing of warnings.
|
||||
.TP 8
|
||||
.B -W
|
||||
Enable the printing of warnings.
|
||||
.TP 8
|
||||
.B -s
|
||||
Enable strict language parsing during compile-time.
|
||||
This will print warnings on dubious JavaScript programming practices.
|
||||
.TP 8
|
||||
.B -x
|
||||
Enable ECMAScript for XML (E4X) support during compile-time.
|
||||
.TP 8
|
||||
.B -C
|
||||
Compile only. This compiles the script but does not
|
||||
execute it.
|
||||
.SS Run-Time Options
|
||||
.TP 8
|
||||
.BI -c " stackchunksize"
|
||||
Set the stack chunk size to
|
||||
.I stackchunksize
|
||||
bytes. The default is
|
||||
.BR 8192 .
|
||||
.TP 8
|
||||
.BI -S " maxstacksize"
|
||||
Set a maximum stack size limit to
|
||||
.I maxstacksize
|
||||
bytes in order to restruct script resource consumption.
|
||||
The default is a stack of unlimited size.
|
||||
.TP 8
|
||||
.BI -b " maxbranches"
|
||||
Set a maximum branch number limit to
|
||||
.I maxbranches
|
||||
in order to restrict script resource consumption. The default is an
|
||||
unlimited number of branches.
|
||||
.TP 8
|
||||
.B -P
|
||||
In case the prototype object of the (potentially changed) global object
|
||||
is no longer connected to the global class, create a new global object
|
||||
(which is again connected to the global class) and set its prototype
|
||||
object to the old global object.
|
||||
.TP 8
|
||||
.BI -v " version"
|
||||
override the numerical JavaScript version number, which the JavaScript
|
||||
.B version()
|
||||
function returns, with the value
|
||||
.IR version .
|
||||
The argument
|
||||
.I version
|
||||
usually is one of the following integer values:
|
||||
.B 0
|
||||
(default),
|
||||
.B 100
|
||||
(JS 1.0),
|
||||
.B 110
|
||||
(JS 1.1),
|
||||
.B 120
|
||||
(JS 1.2),
|
||||
.B 130
|
||||
(JS 1.3),
|
||||
.B 140
|
||||
(JS 1.4),
|
||||
.B 148
|
||||
(ECMA-3),
|
||||
.B 150
|
||||
(JS 1.5),
|
||||
.B 160
|
||||
(JS 1.6).
|
||||
.SS Script Execution
|
||||
.TP 8
|
||||
.BI -e " script"
|
||||
Command-line passed JavaScript script to execute.
|
||||
This is executed immediately during command
|
||||
line parsing, so specify it after
|
||||
.B "Compile-Time Options"
|
||||
and
|
||||
.BR "Run-Time Options" .
|
||||
.TP 7
|
||||
.BI -f " scriptfile"
|
||||
Externally passed JavaScript script to execute.
|
||||
This is executed immediately during command
|
||||
line parsing, so specify it after
|
||||
.B "Compile-Time Options"
|
||||
and
|
||||
.BR "Run-Time Options" .
|
||||
.SH ARGUMENTS
|
||||
.TP 8
|
||||
.RI scriptfile
|
||||
Externally passed JavaScript script to execute.
|
||||
This is executed after command line parsing
|
||||
(and this way after scripts of options
|
||||
.BR -e " and " -f
|
||||
were executed.
|
||||
This additional way of executing an external JavaScript
|
||||
script exists to especially support Unix "shebang"
|
||||
style scripts.
|
||||
.TP 8
|
||||
.IR scriptarg
|
||||
Zero or more arguments which are passed to the executed
|
||||
.IR scriptfile .
|
||||
They are available in the script through the global
|
||||
array object
|
||||
.BR arguments .
|
||||
.SH SEE ALSO
|
||||
.BR js ( 3 ),
|
||||
.BR js-config ( 1 )
|
||||
.PP
|
||||
.RS 0
|
||||
http://www.mozilla.org/js/spidermonkey/
|
||||
.RE
|
||||
.RS 0
|
||||
http://www.ossp.org/pkg/lib/js/
|
||||
.RE
|
||||
.SH AUTHOR
|
||||
The author of the
|
||||
.B Mozilla JavaScript
|
||||
language implementation ("SpiderMonkey") is
|
||||
.I Brendan Eich
|
||||
from the
|
||||
.IR "Mozilla Foundation" .
|
||||
This manual page was written by
|
||||
.I Ralf S. Engelschall
|
||||
for the
|
||||
.B OSSP js
|
||||
distribution of
|
||||
.BR "Mozilla JavaScript" .
|
|
@ -0,0 +1,46 @@
|
|||
.TH JS 3 "22 July 2006"
|
||||
.SH NAME
|
||||
.BR libjs " - Mozilla JavaScript C API"
|
||||
.SH SYNOPSIS
|
||||
.RS 0
|
||||
.B cc `js-config --cppflags` -o foo foo.c `js-config --ldflags --libs`
|
||||
.RE
|
||||
.RS 0
|
||||
.B cc `pkg-config --cflags js` -o foo foo.c `pkg-config --libs js`
|
||||
.RE
|
||||
.SH DESCRIPTION
|
||||
The Mozilla JavaScript C API
|
||||
is the programmatic interface to the
|
||||
.B Mozilla JavaScript
|
||||
language engine ("SpiderMonkey").
|
||||
For the complete reference documentation of the Mozilla JavaScript C API please see
|
||||
the following online documents:
|
||||
.TP 8
|
||||
.I JS Embedder's Guide
|
||||
http://www.mozilla.org/js/spidermonkey/apidoc/jsguide.html
|
||||
.TP 8
|
||||
.I JS Embedder's Reference
|
||||
http://www.mozilla.org/js/spidermonkey/apidoc/complete-frameset.html
|
||||
.SH SEE ALSO
|
||||
.BR js-config ( 1 ),
|
||||
.BR js ( 1 )
|
||||
.PP
|
||||
.RS 0
|
||||
http://www.mozilla.org/js/spidermonkey/
|
||||
.RE
|
||||
.RS 0
|
||||
http://www.ossp.org/pkg/lib/js/
|
||||
.RE
|
||||
.SH AUTHOR
|
||||
The author of the
|
||||
.B Mozilla JavaScript
|
||||
language implementation ("SpiderMonkey") is
|
||||
.I Brendan Eich
|
||||
from the
|
||||
.IR "Mozilla Foundation" .
|
||||
This manual page was written by
|
||||
.I Ralf S. Engelschall
|
||||
for the
|
||||
.B OSSP js
|
||||
distribution of
|
||||
.BR "Mozilla JavaScript" .
|
|
@ -0,0 +1,10 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: OSSP js
|
||||
Description: Mozilla JavaScript Engine
|
||||
Version: @JS_VERSION@
|
||||
Libs: -L${libdir} -ljs @LIBS@
|
||||
Cflags: -DOSSP -DXP_UNIX -I${includedir}/js
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,5 @@
|
|||
Makefile
|
||||
config-defs.h
|
||||
config.cache
|
||||
config.log
|
||||
config.status
|
|
@ -0,0 +1,5 @@
|
|||
/.cvsignore/1.2/Sat May 12 00:53:26 2001//
|
||||
/Makefile.in/1.22/Sun Apr 25 15:00:32 2004//
|
||||
/configure/1.212/Wed Feb 22 02:39:58 2006//
|
||||
/configure.in/1.214/Wed Feb 22 02:39:58 2006//
|
||||
D
|
|
@ -0,0 +1,9 @@
|
|||
A D/admin////
|
||||
A D/build////
|
||||
A D/config////
|
||||
A D/include////
|
||||
A D/lib////
|
||||
A D/macbuild////
|
||||
A D/pkg////
|
||||
A D/pr////
|
||||
A D/tools////
|
|
@ -0,0 +1 @@
|
|||
mozilla/nsprpub
|
|
@ -0,0 +1 @@
|
|||
:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
|
|
@ -0,0 +1,151 @@
|
|||
#! gmake
|
||||
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
|
||||
MOD_DEPTH = .
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(MOD_DEPTH)/config/autoconf.mk
|
||||
|
||||
MAKE := $(patsubst -j%,,$(MAKE)) -j1
|
||||
|
||||
DIRS = config pr lib
|
||||
|
||||
ifdef MOZILLA_CLIENT
|
||||
# Make nsinstall use absolute symlinks by default for Mozilla OSX builds
|
||||
# http://bugzilla.mozilla.org/show_bug.cgi?id=193164
|
||||
ifeq ($(OS_ARCH),Darwin)
|
||||
ifndef NSDISTMODE
|
||||
NSDISTMODE=absolute_symlink
|
||||
export NSDISTMODE
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
DIST_GARBAGE = config.cache config.log config.status
|
||||
|
||||
all:: config.status export
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
config.status:: configure
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
sh $(srcdir)/configure --no-create --no-recursion
|
||||
else
|
||||
./config.status --recheck && ./config.status
|
||||
endif
|
||||
|
||||
#
|
||||
# The -ll option of zip converts CR LF to LF.
|
||||
#
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
ZIP_ASCII_OPT = -ll
|
||||
endif
|
||||
|
||||
# Delete config/autoconf.mk last because it is included by every makefile.
|
||||
distclean::
|
||||
@echo "cd pr/tests; $(MAKE) $@"
|
||||
@$(MAKE) -C pr/tests $@
|
||||
rm -f config/autoconf.mk
|
||||
|
||||
release::
|
||||
echo $(BUILD_NUMBER) > $(RELEASE_DIR)/$(BUILD_NUMBER)/version.df
|
||||
@if test -f imports.df; then \
|
||||
echo "cp -f imports.df $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df"; \
|
||||
cp -f imports.df $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df; \
|
||||
else \
|
||||
echo "echo > $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df"; \
|
||||
echo > $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df; \
|
||||
fi
|
||||
cd $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME); \
|
||||
rm -rf META-INF; mkdir META-INF; cd META-INF; \
|
||||
echo "Manifest-Version: 1.0" > MANIFEST.MF; \
|
||||
echo "" >> MANIFEST.MF; \
|
||||
cd ..; rm -f mdbinary.jar; zip -r mdbinary.jar META-INF bin lib; \
|
||||
rm -rf META-INF; \
|
||||
cd include; \
|
||||
rm -rf META-INF; mkdir META-INF; cd META-INF; \
|
||||
echo "Manifest-Version: 1.0" > MANIFEST.MF; \
|
||||
echo "" >> MANIFEST.MF; \
|
||||
cd ..; rm -f mdheader.jar; zip $(ZIP_ASCII_OPT) -r mdheader.jar *; \
|
||||
rm -rf META-INF
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
@if test ! -d $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER); then \
|
||||
rm -rf $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER); \
|
||||
echo "making directory $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)"; \
|
||||
$(topsrcdir)/config/prmkdir.bat $(MDIST_DOS)\\$(MOD_NAME)\\$(BUILD_NUMBER); \
|
||||
fi
|
||||
@if test ! -d $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(RELEASE_OBJDIR_NAME); then \
|
||||
rm -rf $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(RELEASE_OBJDIR_NAME); \
|
||||
echo "making directory $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(RELEASE_OBJDIR_NAME)"; \
|
||||
$(topsrcdir)/config/prmkdir.bat $(MDIST_DOS)\\$(MOD_NAME)\\$(BUILD_NUMBER)\\$(RELEASE_OBJDIR_NAME); \
|
||||
fi
|
||||
else
|
||||
@if test ! -d $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER); then \
|
||||
rm -rf $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER); \
|
||||
echo "making directory $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)"; \
|
||||
$(NSINSTALL) -D $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER); \
|
||||
chmod 775 $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER); \
|
||||
fi
|
||||
@if test ! -d $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(RELEASE_OBJDIR_NAME); then \
|
||||
rm -rf $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(RELEASE_OBJDIR_NAME); \
|
||||
echo "making directory $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(RELEASE_OBJDIR_NAME)"; \
|
||||
$(NSINSTALL) -D $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(RELEASE_OBJDIR_NAME); \
|
||||
chmod 775 $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(RELEASE_OBJDIR_NAME); \
|
||||
fi
|
||||
endif
|
||||
cd $(RELEASE_DIR)/$(BUILD_NUMBER); \
|
||||
cp -f version.df imports.df $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER); \
|
||||
chmod 664 $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/version.df; \
|
||||
chmod 664 $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/imports.df; \
|
||||
cd $(OBJDIR_NAME); \
|
||||
cp -f mdbinary.jar $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(RELEASE_OBJDIR_NAME); \
|
||||
chmod 664 $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(RELEASE_OBJDIR_NAME)/mdbinary.jar; \
|
||||
cd include; \
|
||||
cp -f mdheader.jar $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(RELEASE_OBJDIR_NAME); \
|
||||
chmod 664 $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(RELEASE_OBJDIR_NAME)/mdheader.jar
|
||||
|
||||
package:
|
||||
@echo "cd pkg; $(MAKE) publish"
|
||||
$(MAKE) -C pkg publish
|
||||
|
||||
depend:
|
||||
@echo "NSPR20 has no dependencies. Skipped."
|
|
@ -0,0 +1,5 @@
|
|||
/explode.pl/1.2/Sun Apr 25 15:00:34 2004//
|
||||
/makeTargetDirs.sh/1.3/Sun Apr 25 15:00:34 2004//
|
||||
/repackage.sh/1.15/Wed Sep 14 23:39:55 2005//
|
||||
/symlinks.sh/1.2/Sun Apr 25 15:00:34 2004//
|
||||
D
|
|
@ -0,0 +1 @@
|
|||
mozilla/nsprpub/admin
|
|
@ -0,0 +1 @@
|
|||
:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
|
|
@ -0,0 +1,75 @@
|
|||
#!/bin/perl
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998-2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
#
|
||||
# explode.pl -- Unpack .jar files into bin, lib, include directories
|
||||
#
|
||||
# syntax: perl explode.pl
|
||||
#
|
||||
# Description:
|
||||
# explode.pl unpacks the .jar files created by the NSPR build
|
||||
# procedure.
|
||||
#
|
||||
# Suggested use: After copying the platform directories to
|
||||
# /s/b/c/nspr20/<release>. CD to /s/b/c/nspr20/<release> and
|
||||
# run explode.pl. This will unpack the jar files into bin, lib,
|
||||
# include directories.
|
||||
#
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
@dirs = `ls -d *.OBJ*`;
|
||||
|
||||
foreach $dir (@dirs) {
|
||||
chop($dir);
|
||||
if (-l $dir) {
|
||||
print "Skipping symbolic link $dir\n";
|
||||
next;
|
||||
}
|
||||
print "Unzipping $dir/mdbinary.jar\n";
|
||||
system ("unzip", "-o", "$dir/mdbinary.jar",
|
||||
"-d", "$dir");
|
||||
system ("rm", "-rf", "$dir/META-INF");
|
||||
mkdir "$dir/include", 0755;
|
||||
print "Unzipping $dir/mdheader.jar\n";
|
||||
system ("unzip", "-o", "-aa",
|
||||
"$dir/mdheader.jar",
|
||||
"-d", "$dir/include");
|
||||
system ("rm", "-rf", "$dir/include/META-INF");
|
||||
}
|
||||
# --- end explode.pl ----------------------------------------------
|
|
@ -0,0 +1,79 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998-2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# makeTargetDirs.sh -- Create target directories for building NSPR
|
||||
#
|
||||
# syntax: makeTargetDirs.sh
|
||||
#
|
||||
# Description:
|
||||
# makeTargetDirs.sh creates a set of directories intended for use
|
||||
# with NSPR's autoconf based build system.
|
||||
#
|
||||
# The enumerated directories are the same as those built for NSPR
|
||||
# 4.1.1. Adjust as needed.
|
||||
#
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
mkdir AIX4.3_64_DBG.OBJ
|
||||
mkdir AIX4.3_64_OPT.OBJ
|
||||
mkdir AIX4.3_DBG.OBJ
|
||||
mkdir AIX4.3_OPT.OBJ
|
||||
mkdir HP-UXB.11.00_64_DBG.OBJ
|
||||
mkdir HP-UXB.11.00_64_OPT.OBJ
|
||||
mkdir HP-UXB.11.00_DBG.OBJ
|
||||
mkdir HP-UXB.11.00_OPT.OBJ
|
||||
mkdir IRIX6.5_n32_PTH_DBG.OBJ
|
||||
mkdir IRIX6.5_n32_PTH_OPT.OBJ
|
||||
mkdir Linux2.2_x86_glibc_PTH_DBG.OBJ
|
||||
mkdir Linux2.2_x86_glibc_PTH_OPT.OBJ
|
||||
mkdir Linux2.4_x86_glibc_PTH_DBG.OBJ
|
||||
mkdir Linux2.4_x86_glibc_PTH_OPT.OBJ
|
||||
mkdir OSF1V4.0D_DBG.OBJ
|
||||
mkdir OSF1V4.0D_OPT.OBJ
|
||||
mkdir SunOS5.6_DBG.OBJ
|
||||
mkdir SunOS5.6_OPT.OBJ
|
||||
mkdir SunOS5.7_64_DBG.OBJ
|
||||
mkdir SunOS5.7_64_OPT.OBJ
|
||||
mkdir WIN954.0_DBG.OBJ
|
||||
mkdir WIN954.0_DBG.OBJD
|
||||
mkdir WIN954.0_OPT.OBJ
|
||||
mkdir WINNT4.0_DBG.OBJ
|
||||
mkdir WINNT4.0_DBG.OBJD
|
||||
mkdir WINNT4.0_OPT.OBJ
|
||||
# --- end makeTargetDirs.sh ---------------------------------------
|
|
@ -0,0 +1,215 @@
|
|||
#! /bin/sh
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998-2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# repackage.sh -- Repackage NSPR from /s/b/c to mozilla.org format
|
||||
#
|
||||
# syntax: repackage.sh
|
||||
#
|
||||
# Description:
|
||||
# repackage.sh creates NSPR binary distributions for mozilla.org from
|
||||
# the internal binary distributions in /share/builds/components/nspr20.
|
||||
# There are reasons why we can't just push the internal binary distributions
|
||||
# to mozilla.org. External developers prefer to use the common archive
|
||||
# file format for their platforms, rather than the jar files we use internally.
|
||||
#
|
||||
# On Unix, we create a tar.gz file. On Windows, we create a zip file.
|
||||
# For example: NSPR 4.1.1, these would be nspr-4.1.1.tar.gz and nspr-4.1.1.zip.
|
||||
#
|
||||
# When unpacked, nspr-4.1.1.tar.gz or nspr-4.1.1.zip should expand to a
|
||||
# nspr-4.1.1 directory that contains three subdirectories: include, lib,
|
||||
# and bin. The header files, with the correct line endings for the
|
||||
# platform, are in nspr-4.1.1/include. The libraries are in nspr-4.1.1/lib.
|
||||
# The executable programs are in nspr-4.1.1/bin.
|
||||
#
|
||||
# Note! Files written with Gnu tar are not readable by some non-Gnu
|
||||
# versions. Sun, in particular.
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
FROMTOP=/share/builds/components/nspr20/v4.7
|
||||
TOTOP=./v4.7
|
||||
NSPRDIR=nspr-4.7
|
||||
SOURCETAG=NSPR_4_7_RTM
|
||||
|
||||
#
|
||||
# enumerate Unix object directories on /s/b/c
|
||||
UNIX_OBJDIRS="
|
||||
AIX4.3_64_DBG.OBJ
|
||||
AIX4.3_64_OPT.OBJ
|
||||
AIX4.3_DBG.OBJ
|
||||
AIX4.3_OPT.OBJ
|
||||
HP-UXB.11.00_64_DBG.OBJ
|
||||
HP-UXB.11.00_64_OPT.OBJ
|
||||
HP-UXB.11.00_DBG.OBJ
|
||||
HP-UXB.11.00_OPT.OBJ
|
||||
IRIX6.5_n32_PTH_DBG.OBJ
|
||||
IRIX6.5_n32_PTH_OPT.OBJ
|
||||
Linux2.2_x86_glibc_PTH_DBG.OBJ
|
||||
Linux2.2_x86_glibc_PTH_OPT.OBJ
|
||||
Linux2.4_x86_glibc_PTH_DBG.OBJ
|
||||
Linux2.4_x86_glibc_PTH_OPT.OBJ
|
||||
OSF1V5.0_DBG.OBJ
|
||||
OSF1V5.0_OPT.OBJ
|
||||
SunOS5.6_DBG.OBJ
|
||||
SunOS5.6_OPT.OBJ
|
||||
SunOS5.8_64_DBG.OBJ
|
||||
SunOS5.8_64_OPT.OBJ
|
||||
SunOS5.8_DBG.OBJ
|
||||
SunOS5.8_OPT.OBJ
|
||||
"
|
||||
#
|
||||
# enumerate Windows object directories on /s/b/c
|
||||
WIN_OBJDIRS="
|
||||
WIN954.0_DBG.OBJ
|
||||
WIN954.0_DBG.OBJD
|
||||
WIN954.0_OPT.OBJ
|
||||
WINNT4.0_DBG.OBJ
|
||||
WINNT4.0_DBG.OBJD
|
||||
WINNT4.0_OPT.OBJ
|
||||
"
|
||||
|
||||
#
|
||||
# Create the destination directory.
|
||||
#
|
||||
echo "removing directory $TOTOP"
|
||||
rm -rf $TOTOP
|
||||
echo "creating directory $TOTOP"
|
||||
mkdir -p $TOTOP
|
||||
|
||||
#
|
||||
# Generate the tar.gz files for Unix platforms.
|
||||
#
|
||||
for OBJDIR in $UNIX_OBJDIRS; do
|
||||
echo "removing directory $NSPRDIR"
|
||||
rm -rf $NSPRDIR
|
||||
echo "creating directory $NSPRDIR"
|
||||
mkdir $NSPRDIR
|
||||
|
||||
echo "creating directory $NSPRDIR/include"
|
||||
mkdir $NSPRDIR/include
|
||||
echo "copying $FROMTOP/$OBJDIR/include"
|
||||
cp -r $FROMTOP/$OBJDIR/include $NSPRDIR
|
||||
|
||||
echo "copying $FROMTOP/$OBJDIR/lib"
|
||||
cp -r $FROMTOP/$OBJDIR/lib $NSPRDIR
|
||||
|
||||
echo "copying $FROMTOP/$OBJDIR/bin"
|
||||
cp -r $FROMTOP/$OBJDIR/bin $NSPRDIR
|
||||
|
||||
echo "creating directory $TOTOP/$OBJDIR"
|
||||
mkdir $TOTOP/$OBJDIR
|
||||
echo "creating $TOTOP/$OBJDIR/$NSPRDIR.tar"
|
||||
tar cvf $TOTOP/$OBJDIR/$NSPRDIR.tar $NSPRDIR
|
||||
echo "gzipping $TOTOP/$OBJDIR/$NSPRDIR.tar"
|
||||
gzip $TOTOP/$OBJDIR/$NSPRDIR.tar
|
||||
done
|
||||
|
||||
#
|
||||
# Generate the zip files for Windows platforms.
|
||||
#
|
||||
for OBJDIR in $WIN_OBJDIRS; do
|
||||
echo "removing directory $NSPRDIR"
|
||||
rm -rf $NSPRDIR
|
||||
echo "creating directory $NSPRDIR"
|
||||
mkdir $NSPRDIR
|
||||
|
||||
echo "creating directory $NSPRDIR/include"
|
||||
mkdir $NSPRDIR/include
|
||||
echo "creating directory $NSPRDIR/include/private"
|
||||
mkdir $NSPRDIR/include/private
|
||||
echo "creating directory $NSPRDIR/include/obsolete"
|
||||
mkdir $NSPRDIR/include/obsolete
|
||||
|
||||
# copy headers and adjust unix line-end to Windows line-end
|
||||
# Note: Watch out for the "sed" command line.
|
||||
# when editing the command, take care to preserve the "^M" as the literal
|
||||
# cntl-M character! in vi, use "cntl-v cntl-m" to enter it!
|
||||
#
|
||||
headers=`ls $FROMTOP/$OBJDIR/include/*.h`
|
||||
for header in $headers; do
|
||||
sed -e 's/$/
/g' $header > $NSPRDIR/include/`basename $header`
|
||||
done
|
||||
headers=`ls $FROMTOP/$OBJDIR/include/obsolete/*.h`
|
||||
for header in $headers; do
|
||||
sed -e 's/$/
/g' $header > $NSPRDIR/include/obsolete/`basename $header`
|
||||
done
|
||||
headers=`ls $FROMTOP/$OBJDIR/include/private/*.h`
|
||||
for header in $headers; do
|
||||
sed -e 's/$/
/g' $header > $NSPRDIR/include/private/`basename $header`
|
||||
done
|
||||
|
||||
echo "copying $FROMTOP/$OBJDIR/lib"
|
||||
cp -r $FROMTOP/$OBJDIR/lib $NSPRDIR
|
||||
|
||||
echo "copying $FROMTOP/$OBJDIR/bin"
|
||||
cp -r $FROMTOP/$OBJDIR/bin $NSPRDIR
|
||||
|
||||
echo "creating directory $TOTOP/$OBJDIR"
|
||||
mkdir $TOTOP/$OBJDIR
|
||||
echo "creating $TOTOP/$OBJDIR/$NSPRDIR.zip"
|
||||
zip -r $TOTOP/$OBJDIR/$NSPRDIR.zip $NSPRDIR
|
||||
done
|
||||
|
||||
#
|
||||
# package the source from CVS
|
||||
#
|
||||
echo "Packaging source"
|
||||
echo "removing directory $NSPRDIR"
|
||||
rm -rf $NSPRDIR
|
||||
echo "creating directory $NSPRDIR"
|
||||
mkdir $NSPRDIR
|
||||
myWD=`pwd`
|
||||
cd $NSPRDIR
|
||||
echo "Pulling source from CVS with tag $SOURCETAG"
|
||||
cvs co -r $SOURCETAG mozilla/nsprpub
|
||||
cd $myWD
|
||||
mkdir $TOTOP/src
|
||||
echo "Creating source tar file: $TOTOP/src/$NSPRDIR.tar"
|
||||
tar cvf $TOTOP/src/$NSPRDIR.tar $NSPRDIR
|
||||
echo "gzip $TOTOP/src/$NSPRDIR.tar"
|
||||
gzip $TOTOP/src/$NSPRDIR.tar
|
||||
|
||||
#
|
||||
# Remove the working directory.
|
||||
#
|
||||
echo "removing directory $NSPRDIR"
|
||||
rm -rf $NSPRDIR
|
||||
# --- end repackage.sh ---------------------------------------------
|
|
@ -0,0 +1,75 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998-2001
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# symlinks.sh -- create links from NSPR builds
|
||||
#
|
||||
# syntax: symlinks.sh
|
||||
#
|
||||
# Description:
|
||||
# symlinks.sh creates some symbolic links for NSPR build targets
|
||||
# that are not actually build, but for which there are NSPR
|
||||
# binaries suitable for running on the intended target. ... got
|
||||
# that?
|
||||
#
|
||||
# Suggested use: After copying NSPR binaries to
|
||||
# /s/b/c/nspr20/<platform> run symlinks.sh to create the links
|
||||
# for all supported platforms.
|
||||
#
|
||||
# The symlinks in this script correspond to the NSPR 4.1.1
|
||||
# release. Adjust as necessary.
|
||||
#
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
ln -s SunOS5.6_DBG.OBJ SunOS5.7_DBG.OBJ
|
||||
ln -s SunOS5.6_OPT.OBJ SunOS5.7_OPT.OBJ
|
||||
|
||||
ln -s SunOS5.6_DBG.OBJ SunOS5.8_DBG.OBJ
|
||||
ln -s SunOS5.6_OPT.OBJ SunOS5.8_OPT.OBJ
|
||||
|
||||
ln -s SunOS5.7_64_DBG.OBJ SunOS5.8_64_DBG.OBJ
|
||||
ln -s SunOS5.7_64_OPT.OBJ SunOS5.8_64_OPT.OBJ
|
||||
|
||||
ln -s OSF1V4.0D_DBG.OBJ OSF1V5.0_DBG.OBJ
|
||||
ln -s OSF1V4.0D_OPT.OBJ OSF1V5.0_OPT.OBJ
|
||||
|
||||
ln -s WINNT4.0_DBG.OBJ WINNT5.0_DBG.OBJ
|
||||
ln -s WINNT4.0_DBG.OBJD WINNT5.0_DBG.OBJD
|
||||
ln -s WINNT4.0_OPT.OBJ WINNT5.0_OPT.OBJ
|
||||
# --- end symlinks.sh ---------------------------------------------
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
/cygwin-wrapper/1.4/Thu Aug 19 16:27:08 2004//
|
||||
D
|
|
@ -0,0 +1 @@
|
|||
A D/autoconf////
|
|
@ -0,0 +1 @@
|
|||
mozilla/nsprpub/build
|
|
@ -0,0 +1 @@
|
|||
:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
|
|
@ -0,0 +1,4 @@
|
|||
/config.guess/1.16/Fri Oct 14 19:22:05 2005//
|
||||
/config.sub/1.17/Fri Oct 14 19:22:05 2005//
|
||||
/install-sh/1.2/Fri Oct 15 02:42:36 1999//
|
||||
D
|
|
@ -0,0 +1 @@
|
|||
mozilla/nsprpub/build/autoconf
|
|
@ -0,0 +1 @@
|
|||
:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,119 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5; it is not part of GNU.
|
||||
#
|
||||
# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
#
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
|
||||
instcmd="$mvprog"
|
||||
chmodcmd=""
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dstdir=`dirname $dst`
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd $dst
|
||||
$doit $mvcmd $dsttmp $dst
|
||||
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,75 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Stupid wrapper to avoid win32 dospath/cygdrive issues
|
||||
# Try not to spawn programs from within this file. If the stuff in here looks royally
|
||||
# confusing, see bug: http://bugzilla.mozilla.org/show_bug.cgi?id=206643
|
||||
# and look at the older versions of this file that are easier to read, but
|
||||
# do basically the same thing
|
||||
#
|
||||
|
||||
prog=$1
|
||||
shift
|
||||
if test -z "$prog"; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# If $CYGDRIVE_MOUNT was not set in configure, give $mountpoint the results of mount -p
|
||||
mountpoint=$CYGDRIVE_MOUNT
|
||||
if test -z "$mountpoint"; then
|
||||
mountpoint=`mount -p`
|
||||
if test -z "$mountpoint"; then
|
||||
print "Cannot determine cygwin mount points. Exiting"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Delete everything but "/cygdrive" (or other mountpoint) from mount=`mount -p`
|
||||
mountpoint=${mountpoint#*/}
|
||||
mountpoint=/${mountpoint%%[!A-Za-z0-9_]*}
|
||||
mountpoint=${mountpoint%/}
|
||||
|
||||
args=""
|
||||
up=""
|
||||
if test "${prog}" = "-up"; then
|
||||
up=1
|
||||
prog=${1}
|
||||
shift
|
||||
fi
|
||||
|
||||
process=1
|
||||
|
||||
# Convert the mountpoint in parameters to Win32 filenames
|
||||
# For instance: /cygdrive/c/foo -> c:/foo
|
||||
for i in "${@}"
|
||||
do
|
||||
if test "${i}" = "-wrap"; then
|
||||
process=1
|
||||
else
|
||||
if test "${i}" = "-nowrap"; then
|
||||
process=
|
||||
else
|
||||
if test -n "${process}"; then
|
||||
if test -n "${up}"; then
|
||||
pathname=${i#-I[a-zA-Z]:/}
|
||||
if ! test "${pathname}" = "${i}"; then
|
||||
no_i=${i#-I}
|
||||
driveletter=${no_i%%:*}
|
||||
i=-I${mountpoint}/${driveletter}/${pathname}
|
||||
fi
|
||||
else
|
||||
eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}'
|
||||
if ! test "${leader}" = "${i}"; then
|
||||
eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}'
|
||||
eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}'
|
||||
driveletter=${no_mountpoint%%/*}
|
||||
i=${leader}${driveletter}:/${pathname}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
args="${args} ${i}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exec $prog $args
|
|
@ -0,0 +1,11 @@
|
|||
nfspwd
|
||||
revdepth
|
||||
my_config.mk
|
||||
my_overrides.mk
|
||||
autoconf.mk
|
||||
nsprincl.mk
|
||||
nsprincl.sh
|
||||
now
|
||||
Makefile
|
||||
nsinstall
|
||||
nspr-config
|
|
@ -0,0 +1,20 @@
|
|||
/.cvsignore/3.5/Fri Jul 20 00:22:11 2001//
|
||||
/Makefile.in/1.21/Wed Nov 23 06:35:18 2005//
|
||||
/autoconf.mk.in/1.36/Wed Feb 22 02:39:59 2006//
|
||||
/config.mk/3.31/Fri Apr 29 21:02:53 2005//
|
||||
/gcc_hidden.h/3.1/Fri Apr 29 21:02:53 2005//
|
||||
/libc_r.h/3.5/Sun Apr 25 15:00:34 2004//
|
||||
/make-system-wrappers.pl/3.1/Fri Apr 29 21:02:53 2005//
|
||||
/nfspwd.pl/3.5/Sun Apr 25 15:00:34 2004//
|
||||
/now.c/3.12/Sun Apr 25 15:00:34 2004//
|
||||
/nsinstall.c/3.21/Sat Dec 24 15:03:29 2005//
|
||||
/nspr-config.in/1.7/Wed May 11 00:53:41 2005//
|
||||
/nspr.m4/1.2/Sat May 12 00:36:57 2001//
|
||||
/nsprincl.mk.in/1.2/Thu Oct 14 15:05:44 1999//
|
||||
/nsprincl.sh.in/1.2/Thu Oct 14 15:05:48 1999//
|
||||
/pathsub.h/3.5/Sun Apr 25 15:00:34 2004//
|
||||
/prdepend.h/1.10/Sun Apr 25 15:00:34 2004//
|
||||
/prmkdir.bat/3.4/Sun Apr 25 15:00:34 2004//
|
||||
/rules.mk/3.63/Wed Feb 22 02:39:59 2006//
|
||||
/system-headers/3.2/Fri May 6 18:46:10 2005//
|
||||
D
|
|
@ -0,0 +1 @@
|
|||
mozilla/nsprpub/config
|
|
@ -0,0 +1 @@
|
|||
:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
|
|
@ -0,0 +1,160 @@
|
|||
#! gmake
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
MOD_DEPTH = ..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(MOD_DEPTH)/config/autoconf.mk
|
||||
|
||||
# Indicate that this directory builds build tools.
|
||||
INTERNAL_TOOLS = 1
|
||||
|
||||
# For sanity's sake, we compile nsinstall without the wrapped system
|
||||
# headers, so that we can use it to set up the wrapped system headers.
|
||||
VISIBILITY_FLAGS =
|
||||
|
||||
# autoconf.mk must be deleted last (from the top-level directory)
|
||||
# because it is included by every makefile.
|
||||
DIST_GARBAGE = nsprincl.mk nsprincl.sh nspr-config
|
||||
|
||||
RELEASE_BINS = nspr-config
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
CSRCS = now.c
|
||||
|
||||
# This version hasn't been ported for us; the one in mozilla/config has
|
||||
ifneq ($(OS_ARCH),OS2)
|
||||
CSRCS += nsinstall.c
|
||||
|
||||
PLSRCS = nfspwd.pl
|
||||
endif
|
||||
|
||||
ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2,$(OS_ARCH)))
|
||||
PROG_SUFFIX = .exe
|
||||
else
|
||||
PROG_SUFFIX =
|
||||
endif
|
||||
|
||||
# Temporary workaround to disable the generation of
|
||||
# library build time because now.c uses the 'long long'
|
||||
# data type that's not available on some platforms.
|
||||
ifeq (,$(filter-out NEC NEXTSTEP QNX SCOOS UNIXWARE,$(OS_ARCH)))
|
||||
DEFINES += -DOMIT_LIB_BUILD_TIME
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), IRIX)
|
||||
ifeq ($(basename $(OS_RELEASE)),6)
|
||||
ifndef NS_USE_GCC
|
||||
ifeq ($(USE_N32),1)
|
||||
XLDOPTS += -n32 -Wl,-woff,85
|
||||
else
|
||||
ifeq ($(USE_64),1)
|
||||
XLDOPTS += -64
|
||||
else
|
||||
XLDOPTS += -32
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), HP-UX)
|
||||
ifeq ($(USE_64),1)
|
||||
XLDOPTS += +DD64
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_OS2_TOOLS),EMX)
|
||||
XCFLAGS = $(OS_CFLAGS)
|
||||
ifeq ($(MOZ_OS2_EMX_OBJECTFORMAT),OMF)
|
||||
XLDOPTS = -Zlinker /PM:VIO
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_OS2_TOOLS),PGCC)
|
||||
XCFLAGS = $(OS_CFLAGS)
|
||||
XLDOPTS = -Zlinker /PM:VIO
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
PROGS = $(OBJDIR)/now$(PROG_SUFFIX)
|
||||
|
||||
ifeq (,$(CROSS_COMPILE)$(filter-out OS2 WINNT,$(OS_ARCH)))
|
||||
TARGETS = $(PROGS)
|
||||
else
|
||||
PROGS += $(OBJDIR)/nsinstall$(PROG_SUFFIX)
|
||||
TARGETS = $(PROGS) $(PLSRCS:.pl=)
|
||||
endif
|
||||
|
||||
OUTOPTION = -o # end of the line
|
||||
ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET)))
|
||||
ifndef NS_USE_GCC
|
||||
OUTOPTION = -Fe
|
||||
endif
|
||||
endif
|
||||
|
||||
# Redefine MAKE_OBJDIR for just this directory
|
||||
define MAKE_OBJDIR
|
||||
if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); else true; fi
|
||||
endef
|
||||
|
||||
export:: $(TARGETS)
|
||||
rm -f $(dist_bindir)/nspr-config
|
||||
|
||||
ifdef WRAP_SYSTEM_INCLUDES
|
||||
export::
|
||||
if test ! -d system_wrappers; then mkdir system_wrappers; fi
|
||||
$(PERL) $(srcdir)/make-system-wrappers.pl system_wrappers < $(srcdir)/system-headers
|
||||
$(INSTALL) system_wrappers $(dist_includedir)
|
||||
endif
|
||||
|
||||
$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
|
||||
@$(MAKE_OBJDIR)
|
||||
ifeq ($(MOZ_OS2_TOOLS),VACPP)
|
||||
$(LD) $(EXEFLAGS) $<
|
||||
else
|
||||
$(CC) $(XCFLAGS) $< $(LDFLAGS) $(XLDOPTS) $(OUTOPTION)$@
|
||||
endif
|
||||
|
||||
install:: nspr.m4
|
||||
$(NSINSTALL) -D $(DESTDIR)$(datadir)/aclocal
|
||||
$(NSINSTALL) -t -m 0644 $< $(DESTDIR)$(datadir)/aclocal
|
|
@ -0,0 +1,129 @@
|
|||
# -*- Mode: Makefile -*-
|
||||
|
||||
INCLUDED_AUTOCONF_MK = 1
|
||||
USE_AUTOCONF = 1
|
||||
@SHELL_OVERRIDE@
|
||||
MOZILLA_CLIENT = @MOZILLA_CLIENT@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
includedir = @includedir@
|
||||
libdir = @libdir@
|
||||
datadir = @datadir@
|
||||
|
||||
dist_prefix = @dist_prefix@
|
||||
dist_bindir = @dist_bindir@
|
||||
dist_includedir = @dist_includedir@
|
||||
dist_libdir = @dist_libdir@
|
||||
|
||||
DIST = $(dist_prefix)
|
||||
|
||||
RELEASE_OBJDIR_NAME = @RELEASE_OBJDIR_NAME@
|
||||
OBJDIR_NAME = @OBJDIR_NAME@
|
||||
OBJDIR = @OBJDIR@
|
||||
OBJ_SUFFIX = @OBJ_SUFFIX@
|
||||
LIB_SUFFIX = @LIB_SUFFIX@
|
||||
DLL_SUFFIX = @DLL_SUFFIX@
|
||||
ASM_SUFFIX = @ASM_SUFFIX@
|
||||
MOD_NAME = @NSPR_MODNAME@
|
||||
|
||||
MOD_MAJOR_VERSION = @MOD_MAJOR_VERSION@
|
||||
MOD_MINOR_VERSION = @MOD_MINOR_VERSION@
|
||||
MOD_PATCH_VERSION = @MOD_PATCH_VERSION@
|
||||
|
||||
LIBNSPR = @LIBNSPR@
|
||||
LIBPLC = @LIBPLC@
|
||||
|
||||
CROSS_COMPILE = @CROSS_COMPILE@
|
||||
BUILD_OPT = @MOZ_OPTIMIZE@
|
||||
|
||||
USE_CPLUS = @USE_CPLUS@
|
||||
USE_IPV6 = @USE_IPV6@
|
||||
USE_N32 = @USE_N32@
|
||||
USE_64 = @USE_64@
|
||||
GC_LEAK_DETECTOR = @GC_LEAK_DETECTOR@
|
||||
ENABLE_STRIP = @ENABLE_STRIP@
|
||||
|
||||
USE_PTHREADS = @USE_PTHREADS@
|
||||
USE_BTHREADS = @USE_BTHREADS@
|
||||
PTHREADS_USER = @USE_USER_PTHREADS@
|
||||
CLASSIC_NSPR = @USE_NSPR_THREADS@
|
||||
|
||||
AS = @AS@
|
||||
ASFLAGS = @ASFLAGS@
|
||||
CC = @CC@
|
||||
CCC = @CXX@
|
||||
NS_USE_GCC = @GNU_CC@
|
||||
GCC_USE_GNU_LD = @GCC_USE_GNU_LD@
|
||||
MSC_VER = @MSC_VER@
|
||||
AR = @AR@
|
||||
AR_FLAGS = @AR_FLAGS@
|
||||
LD = @LD@
|
||||
RANLIB = @RANLIB@
|
||||
PERL = @PERL@
|
||||
RC = @RC@
|
||||
RCFLAGS = @RCFLAGS@
|
||||
STRIP = @STRIP@
|
||||
NSINSTALL = @NSINSTALL@
|
||||
FILTER = @FILTER@
|
||||
IMPLIB = @IMPLIB@
|
||||
CYGWIN_WRAPPER = @CYGWIN_WRAPPER@
|
||||
|
||||
OS_CPPFLAGS = @CPPFLAGS@
|
||||
OS_CFLAGS = $(OS_CPPFLAGS) @CFLAGS@ $(DSO_CFLAGS)
|
||||
OS_CXXFLAGS = $(OS_CPPFLAGS) @CXXFLAGS@ $(DSO_CFLAGS)
|
||||
OS_LIBS = @OS_LIBS@
|
||||
OS_LDFLAGS = @LDFLAGS@
|
||||
OS_DLLFLAGS = @OS_DLLFLAGS@
|
||||
DLLFLAGS = @DLLFLAGS@
|
||||
EXEFLAGS = @EXEFLAGS@
|
||||
OPTIMIZER = @OPTIMIZER@
|
||||
|
||||
MKSHLIB = @MKSHLIB@
|
||||
DSO_CFLAGS = @DSO_CFLAGS@
|
||||
DSO_LDOPTS = @DSO_LDOPTS@
|
||||
|
||||
RESOLVE_LINK_SYMBOLS = @RESOLVE_LINK_SYMBOLS@
|
||||
|
||||
HOST_CC = @HOST_CC@
|
||||
HOST_CFLAGS = @HOST_CFLAGS@
|
||||
HOST_LDFLAGS = @HOST_LDFLAGS@
|
||||
|
||||
DEFINES = @DEFINES@ @DEFS@
|
||||
|
||||
MDCPUCFG_H = @MDCPUCFG_H@
|
||||
PR_MD_CSRCS = @PR_MD_CSRCS@
|
||||
PR_MD_ASFILES = @PR_MD_ASFILES@
|
||||
PR_MD_ARCH_DIR = @PR_MD_ARCH_DIR@
|
||||
CPU_ARCH = @CPU_ARCH@
|
||||
|
||||
OS_TARGET = @OS_TARGET@
|
||||
OS_ARCH = @OS_ARCH@
|
||||
OS_RELEASE = @OS_RELEASE@
|
||||
OS_TEST = @OS_TEST@
|
||||
|
||||
NOSUCHFILE = @NOSUCHFILE@
|
||||
AIX_LINK_OPTS = @AIX_LINK_OPTS@
|
||||
MOZ_OBJFORMAT = @MOZ_OBJFORMAT@
|
||||
ULTRASPARC_LIBRARY = @ULTRASPARC_LIBRARY@
|
||||
|
||||
OBJECT_MODE = @OBJECT_MODE@
|
||||
ifdef OBJECT_MODE
|
||||
export OBJECT_MODE
|
||||
endif
|
||||
|
||||
VISIBILITY_FLAGS = @VISIBILITY_FLAGS@
|
||||
WRAP_SYSTEM_INCLUDES = @WRAP_SYSTEM_INCLUDES@
|
||||
|
||||
MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
|
||||
ifdef MACOSX_DEPLOYMENT_TARGET
|
||||
export MACOSX_DEPLOYMENT_TARGET
|
||||
endif
|
||||
|
||||
MACOS_SDK_DIR = @MACOS_SDK_DIR@
|
||||
|
||||
NEXT_ROOT = @NEXT_ROOT@
|
||||
ifdef NEXT_ROOT
|
||||
export NEXT_ROOT
|
||||
endif
|
|
@ -0,0 +1,164 @@
|
|||
#! gmake
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# Configuration information for building in the NSPR source module
|
||||
|
||||
# Define an include-at-most-once-flag
|
||||
NSPR_CONFIG_MK = 1
|
||||
|
||||
#
|
||||
# The variable definitions in this file are inputs to NSPR's
|
||||
# build system. This file, if present, is included at the
|
||||
# beginning of config.mk.
|
||||
#
|
||||
# For example:
|
||||
#
|
||||
# BUILD_OPT=1
|
||||
# USE_PTHREADS=1
|
||||
# NS_USE_GCC=
|
||||
#
|
||||
ifndef topsrcdir
|
||||
topsrcdir=$(MOD_DEPTH)
|
||||
endif
|
||||
|
||||
ifndef srcdir
|
||||
srcdir=.
|
||||
endif
|
||||
|
||||
NFSPWD = $(MOD_DEPTH)/config/nfspwd
|
||||
|
||||
CFLAGS = $(VISIBILITY_FLAGS) $(CC_ONLY_FLAGS) $(OPTIMIZER)\
|
||||
$(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
|
||||
CCCFLAGS = $(VISIBILITY_FLAGS) $(CCC_ONLY_FLAGS) $(OPTIMIZER)\
|
||||
$(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
|
||||
# For purify
|
||||
NOMD_CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\
|
||||
$(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
|
||||
NOMD_CCFLAGS = $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\
|
||||
$(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS)
|
||||
|
||||
LDFLAGS = $(OS_LDFLAGS)
|
||||
|
||||
define MAKE_OBJDIR
|
||||
if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi
|
||||
endef
|
||||
|
||||
LINK_DLL = $(LD) $(OS_DLLFLAGS) $(DLLFLAGS)
|
||||
|
||||
ifeq ($(OS_ARCH),Darwin)
|
||||
PWD := $(shell pwd)
|
||||
endif
|
||||
|
||||
ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
|
||||
INSTALL = $(NSINSTALL)
|
||||
else
|
||||
ifeq ($(NSDISTMODE),copy)
|
||||
# copy files, but preserve source mtime
|
||||
INSTALL = $(NSINSTALL) -t
|
||||
else
|
||||
ifeq ($(NSDISTMODE),absolute_symlink)
|
||||
# install using absolute symbolic links
|
||||
ifeq ($(OS_ARCH),Darwin)
|
||||
INSTALL = $(NSINSTALL) -L $(PWD)
|
||||
else
|
||||
INSTALL = $(NSINSTALL) -L `$(NFSPWD)`
|
||||
endif
|
||||
else
|
||||
# install using relative symbolic links
|
||||
INSTALL = $(NSINSTALL) -R
|
||||
endif
|
||||
endif
|
||||
endif # (WINNT || OS2) && !CROSS_COMPILE
|
||||
|
||||
DEPENDENCIES = $(OBJDIR)/.md
|
||||
|
||||
ifdef BUILD_DEBUG_GC
|
||||
DEFINES += -DDEBUG_GC
|
||||
endif
|
||||
|
||||
GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*)
|
||||
|
||||
DIST_GARBAGE += Makefile
|
||||
|
||||
####################################################################
|
||||
#
|
||||
# The NSPR-specific configuration
|
||||
#
|
||||
####################################################################
|
||||
|
||||
DEFINES += -DFORCE_PR_LOG
|
||||
|
||||
ifeq ($(_PR_NO_CLOCK_TIMER),1)
|
||||
DEFINES += -D_PR_NO_CLOCK_TIMER
|
||||
endif
|
||||
|
||||
ifeq ($(USE_PTHREADS), 1)
|
||||
DEFINES += -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM
|
||||
endif
|
||||
|
||||
ifeq ($(PTHREADS_USER), 1)
|
||||
DEFINES += -DPTHREADS_USER -UHAVE_CVAR_BUILT_ON_SEM
|
||||
endif
|
||||
|
||||
ifeq ($(USE_IPV6),1)
|
||||
DEFINES += -D_PR_INET6
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_UNICODE),1)
|
||||
DEFINES += -DMOZ_UNICODE
|
||||
endif
|
||||
|
||||
####################################################################
|
||||
#
|
||||
# Configuration for the release process
|
||||
#
|
||||
####################################################################
|
||||
|
||||
MDIST = /m/dist
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
MDIST = //helium/dist
|
||||
MDIST_DOS = $(subst /,\\,$(MDIST))
|
||||
endif
|
||||
|
||||
# RELEASE_DIR is ns/dist/<module name>
|
||||
|
||||
RELEASE_DIR = $(MOD_DEPTH)/dist/release/$(MOD_NAME)
|
||||
|
||||
RELEASE_INCLUDE_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/include
|
||||
RELEASE_BIN_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/bin
|
||||
RELEASE_LIB_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/lib
|
|
@ -0,0 +1,2 @@
|
|||
/* Begin all files as hidden visibility */
|
||||
#pragma GCC visibility push(hidden)
|
|
@ -0,0 +1,158 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* libc_r.h -- macros, defines, etc. to make using reentrant libc calls */
|
||||
/* a bit easier. This was initially done for AIX pthreads, */
|
||||
/* but should be usable for anyone... */
|
||||
|
||||
/* Most of these use locally defined space instead of static library space. */
|
||||
/* Because of this, we use the _INIT_R to declare/allocate space (stack), */
|
||||
/* and the plain routines to actually do it..._WARNING_: avoid allocating */
|
||||
/* memory wherever possible. Memory allocation is fairly expensive, at */
|
||||
/* least on AIX...use arrays instead (which allocate from the stack.) */
|
||||
/* I know the names are a bit strange, but I wanted to be fairly certain */
|
||||
/* that we didn't have any namespace corruption...in general, the inits are */
|
||||
/* R_<name>_INIT_R(), and the actual calls are R_<name>_R(). */
|
||||
|
||||
#ifndef _LIBC_R_H
|
||||
#define _LIBC_R_H
|
||||
|
||||
/************/
|
||||
/* strtok */
|
||||
/************/
|
||||
#define R_STRTOK_INIT_R() \
|
||||
char *r_strtok_r=NULL
|
||||
|
||||
#define R_STRTOK_R(return,source,delim) \
|
||||
return=strtok_r(source,delim,&r_strtok_r)
|
||||
|
||||
#define R_STRTOK_NORET_R(source,delim) \
|
||||
strtok_r(source,delim,&r_strtok_r)
|
||||
|
||||
/**************/
|
||||
/* strerror */
|
||||
/**************/
|
||||
#define R_MAX_STRERROR_LEN_R 8192 /* Straight from limits.h */
|
||||
|
||||
#define R_STRERROR_INIT_R() \
|
||||
char r_strerror_r[R_MAX_STRERROR_LEN_R]
|
||||
|
||||
#define R_STRERROR_R(val) \
|
||||
strerror_r(val,r_strerror_r,R_MAX_STRERROR_LEN_R)
|
||||
|
||||
/*****************/
|
||||
/* time things */
|
||||
/*****************/
|
||||
#define R_ASCTIME_INIT_R() \
|
||||
char r_asctime_r[26]
|
||||
|
||||
#define R_ASCTIME_R(val) \
|
||||
asctime_r(val,r_asctime_r)
|
||||
|
||||
#define R_CTIME_INIT_R() \
|
||||
char r_ctime_r[26]
|
||||
|
||||
#define R_CTIME_R(val) \
|
||||
ctime_r(val,r_ctime_r)
|
||||
|
||||
#define R_GMTIME_INIT_R() \
|
||||
struct tm r_gmtime_r
|
||||
|
||||
#define R_GMTIME_R(time) \
|
||||
gmtime_r(time,&r_gmtime_r)
|
||||
|
||||
#define R_LOCALTIME_INIT_R() \
|
||||
struct tm r_localtime_r
|
||||
|
||||
#define R_LOCALTIME_R(val) \
|
||||
localtime_r(val,&r_localtime_r)
|
||||
|
||||
/***********/
|
||||
/* crypt */
|
||||
/***********/
|
||||
#include <crypt.h>
|
||||
#define R_CRYPT_INIT_R() \
|
||||
CRYPTD r_cryptd_r; \
|
||||
bzero(&r_cryptd_r,sizeof(CRYPTD))
|
||||
|
||||
#define R_CRYPT_R(pass,salt) \
|
||||
crypt_r(pass,salt,&r_cryptd_r)
|
||||
|
||||
/**************/
|
||||
/* pw stuff */
|
||||
/**************/
|
||||
#define R_MAX_PW_LEN_R 1024
|
||||
/* The following must be after the last declaration, but */
|
||||
/* before the first bit of code... */
|
||||
#define R_GETPWNAM_INIT_R(pw_ptr) \
|
||||
struct passwd r_getpwnam_pw_r; \
|
||||
char r_getpwnam_line_r[R_MAX_PW_LEN_R]; \
|
||||
pw_ptr = &r_getpwnam_pw_r
|
||||
|
||||
#define R_GETPWNAM_R(name) \
|
||||
getpwnam_r(name,&r_getpwnam_pw_r,r_getpwnam_line_r,R_MAX_PW_LEN_R)
|
||||
|
||||
/*******************/
|
||||
/* gethost stuff */
|
||||
/*******************/
|
||||
#define R_GETHOSTBYADDR_INIT_R() \
|
||||
struct hostent r_gethostbyaddr_r; \
|
||||
struct hostent_data r_gethostbyaddr_data_r
|
||||
|
||||
#define R_GETHOSTBYADDR_R(addr,len,type,xptr_ent) \
|
||||
bzero(&r_gethostbyaddr_r,sizeof(struct hostent)); \
|
||||
bzero(&r_gethostbyaddr_data_r,sizeof(struct hostent_data)); \
|
||||
xptr_ent = &r_gethostbyaddr_r; \
|
||||
if (gethostbyaddr_r(addr,len,type, \
|
||||
&r_gethostbyaddr_r,&r_gethostbyaddr_data_r) == -1) { \
|
||||
xptr_ent = NULL; \
|
||||
}
|
||||
|
||||
#define R_GETHOSTBYNAME_INIT_R() \
|
||||
struct hostent r_gethostbyname_r; \
|
||||
struct hostent_data r_gethostbyname_data_r
|
||||
|
||||
#define R_GETHOSTBYNAME_R(name,xptr_ent) \
|
||||
bzero(&r_gethostbyname_r,sizeof(struct hostent)); \
|
||||
bzero(&r_gethostbyname_data_r,sizeof(struct hostent_data)); \
|
||||
xptr_ent = &r_gethostbyname_r; \
|
||||
if (gethostbyname_r(name, \
|
||||
&r_gethostbyname_r,&r_gethostbyname_data_r) == -1) { \
|
||||
xptr_ent = NULL; \
|
||||
}
|
||||
|
||||
#endif /* _LIBC_R_H */
|
|
@ -0,0 +1,59 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# IBM Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Brian Ryner <bryner@brianryner.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
$output_dir = shift;
|
||||
|
||||
while (<STDIN>) {
|
||||
chomp;
|
||||
if (-e "$output_dir/$_") {
|
||||
next;
|
||||
}
|
||||
|
||||
if (/(.*)\/[^\/*]/) {
|
||||
mkdir "$output_dir/$1";
|
||||
}
|
||||
|
||||
open OUT, ">$output_dir/$_";
|
||||
print OUT "#pragma GCC system_header\n"; # suppress include_next warning
|
||||
print OUT "#pragma GCC visibility push(default)\n";
|
||||
print OUT "#include_next \<$_\>\n";
|
||||
print OUT "#pragma GCC visibility pop\n";
|
||||
close OUT;
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
#! perl
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
require "fastcwd.pl";
|
||||
|
||||
$_ = &fastcwd;
|
||||
if (m@^/[uh]/@o || s@^/tmp_mnt/@/@o) {
|
||||
print("$_\n");
|
||||
} elsif ((($user, $rest) = m@^/usr/people/(\w+)/(.*)@o)
|
||||
&& readlink("/u/$user") eq "/usr/people/$user") {
|
||||
print("/u/$user/$rest\n");
|
||||
} else {
|
||||
chop($host = `hostname`);
|
||||
print("/h/$host$_\n");
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(VMS)
|
||||
#include <sys/timeb.h>
|
||||
#elif defined(XP_UNIX) || defined(XP_OS2_EMX) || defined(XP_BEOS)
|
||||
#include <sys/time.h>
|
||||
#elif defined(WIN32)
|
||||
#include <windows.h>
|
||||
#elif defined(XP_OS2_VACPP)
|
||||
#include <sys/timeb.h>
|
||||
#else
|
||||
#error "Architecture not supported"
|
||||
#endif
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#if defined(OMIT_LIB_BUILD_TIME)
|
||||
/*
|
||||
* Some platforms don't have any 64-bit integer type
|
||||
* such as 'long long'. Because we can't use NSPR's
|
||||
* PR_snprintf in this program, it is difficult to
|
||||
* print a static initializer for PRInt64 (a struct).
|
||||
* So we print nothing. The makefiles that build the
|
||||
* shared libraries will detect the empty output string
|
||||
* of this program and omit the library build time
|
||||
* in PRVersionDescription.
|
||||
*/
|
||||
#elif defined(VMS)
|
||||
long long now;
|
||||
struct timeb b;
|
||||
ftime(&b);
|
||||
now = b.time;
|
||||
now *= 1000000;
|
||||
now += (1000 * b.millitm);
|
||||
fprintf(stdout, "%Ld", now);
|
||||
#elif defined(XP_UNIX) || defined(XP_OS2_EMX) || defined(XP_BEOS)
|
||||
long long now;
|
||||
struct timeval tv;
|
||||
#ifdef HAVE_SVID_GETTOD
|
||||
gettimeofday(&tv);
|
||||
#else
|
||||
gettimeofday(&tv, NULL);
|
||||
#endif
|
||||
now = ((1000000LL) * tv.tv_sec) + (long long)tv.tv_usec;
|
||||
#if defined(OSF1)
|
||||
fprintf(stdout, "%ld", now);
|
||||
#elif defined(BEOS) && defined(__POWERPC__)
|
||||
fprintf(stdout, "%Ld", now); /* Metroworks on BeOS PPC */
|
||||
#else
|
||||
fprintf(stdout, "%lld", now);
|
||||
#endif
|
||||
|
||||
#elif defined(WIN32)
|
||||
__int64 now;
|
||||
FILETIME ft;
|
||||
GetSystemTimeAsFileTime(&ft);
|
||||
CopyMemory(&now, &ft, sizeof(now));
|
||||
/*
|
||||
* 116444736000000000 is the number of 100-nanosecond intervals
|
||||
* between Jan. 1, 1601 and Jan. 1, 1970.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
now = (now - 116444736000000000LL) / 10LL;
|
||||
fprintf(stdout, "%lld", now);
|
||||
#else
|
||||
now = (now - 116444736000000000i64) / 10i64;
|
||||
fprintf(stdout, "%I64d", now);
|
||||
#endif
|
||||
|
||||
#elif defined(XP_OS2_VACPP)
|
||||
/* no long long or i64 so we use a string */
|
||||
#include <string.h>
|
||||
char buf[24];
|
||||
char tbuf[7];
|
||||
time_t now;
|
||||
long mtime;
|
||||
int i;
|
||||
|
||||
struct timeb b;
|
||||
ftime(&b);
|
||||
now = b.time;
|
||||
_ltoa(now, buf, 10);
|
||||
|
||||
mtime = b.millitm * 1000;
|
||||
if (mtime == 0){
|
||||
++now;
|
||||
strcat(buf, "000000");
|
||||
} else {
|
||||
_ltoa(mtime, tbuf, 10);
|
||||
for (i = strlen(tbuf); i < 6; ++i)
|
||||
strcat(buf, "0");
|
||||
strcat(buf, tbuf);
|
||||
}
|
||||
fprintf(stdout, "%s", buf);
|
||||
|
||||
#else
|
||||
#error "Architecture not supported"
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
} /* main */
|
||||
|
||||
/* now.c */
|
|
@ -0,0 +1,602 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
** Netscape portable install command.
|
||||
**
|
||||
** Brendan Eich, 7/20/95
|
||||
*/
|
||||
#include <stdio.h> /* OSF/1 requires this before grp.h, so put it first */
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#ifdef USE_REENTRANT_LIBC
|
||||
#include "libc_r.h"
|
||||
#endif /* USE_REENTRANT_LIBC */
|
||||
|
||||
#include "pathsub.h"
|
||||
|
||||
#define HAVE_FCHMOD
|
||||
|
||||
#if defined(BEOS)
|
||||
#undef HAVE_FCHMOD
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Does getcwd() take NULL as the first argument and malloc
|
||||
* the result buffer?
|
||||
*/
|
||||
#if !defined(DARWIN) && !defined(NEXTSTEP) && !defined(VMS)
|
||||
#define GETCWD_CAN_MALLOC
|
||||
#endif
|
||||
|
||||
#ifdef NEXTSTEP
|
||||
#include <bsd/libc.h>
|
||||
|
||||
/*
|
||||
** balazs.pataki@sztaki.hu: The getcwd is broken in NEXTSTEP (returns 0),
|
||||
** when called on a mounted fs. Did anyone notice this? Here's an ugly
|
||||
** workaround ...
|
||||
*/
|
||||
#define getcwd(b,s) my_getcwd(b,s)
|
||||
|
||||
static char *
|
||||
my_getcwd (char *buf, size_t size)
|
||||
{
|
||||
FILE *pwd = popen("pwd", "r");
|
||||
char *result = fgets(buf, size, pwd);
|
||||
|
||||
if (result) {
|
||||
buf[strlen(buf)-1] = '\0';
|
||||
}
|
||||
pclose (pwd);
|
||||
return buf;
|
||||
}
|
||||
#endif /* NEXTSTEP */
|
||||
|
||||
#if defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#if defined(SCO) || defined(UNIXWARE) || defined(SNI) || defined(NCR) || defined(NEC) || defined(NEXTSTEP)
|
||||
#if !defined(S_ISLNK) && defined(S_IFLNK)
|
||||
#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(SNI)
|
||||
extern int fchmod(int fildes, mode_t mode);
|
||||
#endif
|
||||
|
||||
#ifdef QNX
|
||||
#define d_ino d_stat.st_ino
|
||||
#endif
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: %s [-C cwd] [-L linkprefix] [-m mode] [-o owner] [-g group]\n"
|
||||
" %*s [-DdltR] file [file ...] directory\n",
|
||||
program, (int)strlen(program), "");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
static int
|
||||
mkdirs(char *path, mode_t mode)
|
||||
{
|
||||
char *cp;
|
||||
struct stat sb;
|
||||
int res;
|
||||
|
||||
while (*path == '/' && path[1] == '/')
|
||||
path++;
|
||||
while ((cp = strrchr(path, '/')) && cp[1] == '\0')
|
||||
*cp = '\0';
|
||||
if (cp && cp != path) {
|
||||
*cp = '\0';
|
||||
if ((stat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
|
||||
mkdirs(path, mode) < 0) {
|
||||
return -1;
|
||||
}
|
||||
*cp = '/';
|
||||
}
|
||||
res = mkdir(path, mode);
|
||||
if ((res != 0) && (errno == EEXIST))
|
||||
return 0;
|
||||
else
|
||||
return res;
|
||||
}
|
||||
|
||||
static uid_t
|
||||
touid(char *owner)
|
||||
{
|
||||
struct passwd *pw;
|
||||
uid_t uid;
|
||||
char *cp;
|
||||
|
||||
pw = getpwnam(owner);
|
||||
if (pw)
|
||||
return pw->pw_uid;
|
||||
uid = strtol(owner, &cp, 0);
|
||||
if (uid == 0 && cp == owner)
|
||||
fail("cannot find uid for %s", owner);
|
||||
return uid;
|
||||
}
|
||||
|
||||
static gid_t
|
||||
togid(char *group)
|
||||
{
|
||||
struct group *gr;
|
||||
gid_t gid;
|
||||
char *cp;
|
||||
|
||||
gr = getgrnam(group);
|
||||
if (gr)
|
||||
return gr->gr_gid;
|
||||
gid = strtol(group, &cp, 0);
|
||||
if (gid == 0 && cp == group)
|
||||
fail("cannot find gid for %s", group);
|
||||
return gid;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int onlydir, dodir, dolink, dorelsymlink, dotimes, opt, len, lplen, tdlen, bnlen, exists, fromfd, tofd, cc, wc;
|
||||
mode_t mode = 0755;
|
||||
char *linkprefix, *owner, *group, *cp, *cwd, *todir, *toname, *name, *base, *linkname, *bp, buf[BUFSIZ];
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
struct stat sb, tosb;
|
||||
struct utimbuf utb;
|
||||
|
||||
program = argv[0];
|
||||
cwd = linkname = linkprefix = owner = group = 0;
|
||||
onlydir = dodir = dolink = dorelsymlink = dotimes = lplen = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "C:DdlL:Rm:o:g:t")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'C':
|
||||
cwd = optarg;
|
||||
break;
|
||||
case 'D':
|
||||
onlydir = 1;
|
||||
break;
|
||||
case 'd':
|
||||
dodir = 1;
|
||||
break;
|
||||
case 'l':
|
||||
dolink = 1;
|
||||
break;
|
||||
case 'L':
|
||||
linkprefix = optarg;
|
||||
lplen = strlen(linkprefix);
|
||||
dolink = 1;
|
||||
break;
|
||||
case 'R':
|
||||
dolink = dorelsymlink = 1;
|
||||
break;
|
||||
case 'm':
|
||||
mode = strtoul(optarg, &cp, 8);
|
||||
if (mode == 0 && cp == optarg)
|
||||
usage();
|
||||
break;
|
||||
case 'o':
|
||||
owner = optarg;
|
||||
break;
|
||||
case 'g':
|
||||
group = optarg;
|
||||
break;
|
||||
case 't':
|
||||
dotimes = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc < 2 - onlydir)
|
||||
usage();
|
||||
|
||||
todir = argv[argc-1];
|
||||
if ((stat(todir, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
|
||||
mkdirs(todir, 0777) < 0) {
|
||||
fail("cannot make directory %s", todir);
|
||||
}
|
||||
if (onlydir)
|
||||
return 0;
|
||||
|
||||
if (!cwd) {
|
||||
#ifdef GETCWD_CAN_MALLOC
|
||||
cwd = getcwd(0, PATH_MAX);
|
||||
#else
|
||||
cwd = malloc(PATH_MAX + 1);
|
||||
cwd = getcwd(cwd, PATH_MAX);
|
||||
#endif
|
||||
}
|
||||
xchdir(todir);
|
||||
#ifdef GETCWD_CAN_MALLOC
|
||||
todir = getcwd(0, PATH_MAX);
|
||||
#else
|
||||
todir = malloc(PATH_MAX + 1);
|
||||
todir = getcwd(todir, PATH_MAX);
|
||||
#endif
|
||||
tdlen = strlen(todir);
|
||||
xchdir(cwd);
|
||||
tdlen = strlen(todir);
|
||||
|
||||
uid = owner ? touid(owner) : -1;
|
||||
gid = group ? togid(group) : -1;
|
||||
|
||||
while (--argc > 0) {
|
||||
name = *argv++;
|
||||
len = strlen(name);
|
||||
base = xbasename(name);
|
||||
bnlen = strlen(base);
|
||||
toname = (char*)xmalloc(tdlen + 1 + bnlen + 1);
|
||||
sprintf(toname, "%s/%s", todir, base);
|
||||
exists = (lstat(toname, &tosb) == 0);
|
||||
|
||||
if (dodir) {
|
||||
/* -d means create a directory, always */
|
||||
if (exists && !S_ISDIR(tosb.st_mode)) {
|
||||
(void) unlink(toname);
|
||||
exists = 0;
|
||||
}
|
||||
if (!exists && mkdir(toname, mode) < 0)
|
||||
fail("cannot make directory %s", toname);
|
||||
if ((owner || group) && chown(toname, uid, gid) < 0)
|
||||
fail("cannot change owner of %s", toname);
|
||||
} else if (dolink) {
|
||||
if (*name == '/') {
|
||||
/* source is absolute pathname, link to it directly */
|
||||
linkname = 0;
|
||||
} else {
|
||||
if (linkprefix) {
|
||||
/* -L implies -l and prefixes names with a $cwd arg. */
|
||||
len += lplen + 1;
|
||||
linkname = (char*)xmalloc(len + 1);
|
||||
sprintf(linkname, "%s/%s", linkprefix, name);
|
||||
} else if (dorelsymlink) {
|
||||
/* Symlink the relative path from todir to source name. */
|
||||
linkname = (char*)xmalloc(PATH_MAX);
|
||||
|
||||
if (*todir == '/') {
|
||||
/* todir is absolute: skip over common prefix. */
|
||||
lplen = relatepaths(todir, cwd, linkname);
|
||||
strcpy(linkname + lplen, name);
|
||||
} else {
|
||||
/* todir is named by a relative path: reverse it. */
|
||||
reversepath(todir, name, len, linkname);
|
||||
xchdir(cwd);
|
||||
}
|
||||
|
||||
len = strlen(linkname);
|
||||
}
|
||||
name = linkname;
|
||||
}
|
||||
|
||||
/* Check for a pre-existing symlink with identical content. */
|
||||
if (exists &&
|
||||
(!S_ISLNK(tosb.st_mode) ||
|
||||
readlink(toname, buf, sizeof buf) != len ||
|
||||
strncmp(buf, name, len) != 0)) {
|
||||
(void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
|
||||
exists = 0;
|
||||
}
|
||||
if (!exists && symlink(name, toname) < 0)
|
||||
fail("cannot make symbolic link %s", toname);
|
||||
#ifdef HAVE_LCHOWN
|
||||
if ((owner || group) && lchown(toname, uid, gid) < 0)
|
||||
fail("cannot change owner of %s", toname);
|
||||
#endif
|
||||
|
||||
if (linkname) {
|
||||
free(linkname);
|
||||
linkname = 0;
|
||||
}
|
||||
} else {
|
||||
/* Copy from name to toname, which might be the same file. */
|
||||
fromfd = open(name, O_RDONLY);
|
||||
if (fromfd < 0 || fstat(fromfd, &sb) < 0)
|
||||
fail("cannot access %s", name);
|
||||
if (exists && (!S_ISREG(tosb.st_mode) || access(toname, W_OK) < 0))
|
||||
(void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
|
||||
tofd = open(toname, O_CREAT | O_WRONLY, 0666);
|
||||
if (tofd < 0)
|
||||
fail("cannot create %s", toname);
|
||||
|
||||
bp = buf;
|
||||
while ((cc = read(fromfd, bp, sizeof buf)) > 0) {
|
||||
while ((wc = write(tofd, bp, cc)) > 0) {
|
||||
if ((cc -= wc) == 0)
|
||||
break;
|
||||
bp += wc;
|
||||
}
|
||||
if (wc < 0)
|
||||
fail("cannot write to %s", toname);
|
||||
}
|
||||
if (cc < 0)
|
||||
fail("cannot read from %s", name);
|
||||
|
||||
if (ftruncate(tofd, sb.st_size) < 0)
|
||||
fail("cannot truncate %s", toname);
|
||||
/*
|
||||
** On OpenVMS we can't chmod() until the file is closed, and we
|
||||
** have to utime() last since fchown/chmod alter the timestamps.
|
||||
*/
|
||||
#ifndef VMS
|
||||
if (dotimes) {
|
||||
utb.actime = sb.st_atime;
|
||||
utb.modtime = sb.st_mtime;
|
||||
if (utime(toname, &utb) < 0)
|
||||
fail("cannot set times of %s", toname);
|
||||
}
|
||||
#ifdef HAVE_FCHMOD
|
||||
if (fchmod(tofd, mode) < 0)
|
||||
#else
|
||||
if (chmod(toname, mode) < 0)
|
||||
#endif
|
||||
fail("cannot change mode of %s", toname);
|
||||
#endif
|
||||
if ((owner || group) && fchown(tofd, uid, gid) < 0)
|
||||
fail("cannot change owner of %s", toname);
|
||||
|
||||
/* Must check for delayed (NFS) write errors on close. */
|
||||
if (close(tofd) < 0)
|
||||
fail("cannot write to %s", toname);
|
||||
close(fromfd);
|
||||
#ifdef VMS
|
||||
if (chmod(toname, mode) < 0)
|
||||
fail("cannot change mode of %s", toname);
|
||||
if (dotimes) {
|
||||
utb.actime = sb.st_atime;
|
||||
utb.modtime = sb.st_mtime;
|
||||
if (utime(toname, &utb) < 0)
|
||||
fail("cannot set times of %s", toname);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
free(toname);
|
||||
}
|
||||
|
||||
free(cwd);
|
||||
free(todir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Pathname subroutines.
|
||||
**
|
||||
** Brendan Eich, 8/29/95
|
||||
*/
|
||||
|
||||
char *program;
|
||||
|
||||
void
|
||||
fail(char *format, ...)
|
||||
{
|
||||
int error;
|
||||
va_list ap;
|
||||
|
||||
#ifdef USE_REENTRANT_LIBC
|
||||
R_STRERROR_INIT_R();
|
||||
#endif
|
||||
|
||||
error = errno;
|
||||
fprintf(stderr, "%s: ", program);
|
||||
va_start(ap, format);
|
||||
vfprintf(stderr, format, ap);
|
||||
va_end(ap);
|
||||
if (error)
|
||||
|
||||
#ifdef USE_REENTRANT_LIBC
|
||||
R_STRERROR_R(errno);
|
||||
fprintf(stderr, ": %s", r_strerror_r);
|
||||
#else
|
||||
fprintf(stderr, ": %s", strerror(errno));
|
||||
#endif
|
||||
|
||||
putc('\n', stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char *
|
||||
getcomponent(char *path, char *name)
|
||||
{
|
||||
if (*path == '\0')
|
||||
return 0;
|
||||
if (*path == '/') {
|
||||
*name++ = '/';
|
||||
} else {
|
||||
do {
|
||||
*name++ = *path++;
|
||||
} while (*path != '/' && *path != '\0');
|
||||
}
|
||||
*name = '\0';
|
||||
while (*path == '/')
|
||||
path++;
|
||||
return path;
|
||||
}
|
||||
|
||||
#ifdef UNIXWARE_READDIR_BUFFER_TOO_SMALL
|
||||
/* Sigh. The static buffer in Unixware's readdir is too small. */
|
||||
struct dirent * readdir(DIR *d)
|
||||
{
|
||||
static struct dirent *buf = NULL;
|
||||
#define MAX_PATH_LEN 1024
|
||||
|
||||
|
||||
if(buf == NULL)
|
||||
buf = (struct dirent *) malloc(sizeof(struct dirent) + MAX_PATH_LEN)
|
||||
;
|
||||
return(readdir_r(d, buf));
|
||||
}
|
||||
#endif
|
||||
|
||||
char *
|
||||
ino2name(ino_t ino, char *dir)
|
||||
{
|
||||
DIR *dp;
|
||||
struct dirent *ep;
|
||||
char *name;
|
||||
|
||||
dp = opendir("..");
|
||||
if (!dp)
|
||||
fail("cannot read parent directory");
|
||||
for (;;) {
|
||||
if (!(ep = readdir(dp)))
|
||||
fail("cannot find current directory");
|
||||
if (ep->d_ino == ino)
|
||||
break;
|
||||
}
|
||||
name = xstrdup(ep->d_name);
|
||||
closedir(dp);
|
||||
return name;
|
||||
}
|
||||
|
||||
void *
|
||||
xmalloc(size_t size)
|
||||
{
|
||||
void *p = malloc(size);
|
||||
if (!p)
|
||||
fail("cannot allocate %u bytes", size);
|
||||
return p;
|
||||
}
|
||||
|
||||
char *
|
||||
xstrdup(char *s)
|
||||
{
|
||||
return strcpy((char*)xmalloc(strlen(s) + 1), s);
|
||||
}
|
||||
|
||||
char *
|
||||
xbasename(char *path)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
while ((cp = strrchr(path, '/')) && cp[1] == '\0')
|
||||
*cp = '\0';
|
||||
if (!cp) return path;
|
||||
return cp + 1;
|
||||
}
|
||||
|
||||
void
|
||||
xchdir(char *dir)
|
||||
{
|
||||
if (chdir(dir) < 0)
|
||||
fail("cannot change directory to %s", dir);
|
||||
}
|
||||
|
||||
int
|
||||
relatepaths(char *from, char *to, char *outpath)
|
||||
{
|
||||
char *cp, *cp2;
|
||||
int len;
|
||||
char buf[NAME_MAX];
|
||||
|
||||
assert(*from == '/' && *to == '/');
|
||||
for (cp = to, cp2 = from; *cp == *cp2; cp++, cp2++)
|
||||
if (*cp == '\0')
|
||||
break;
|
||||
while (cp[-1] != '/')
|
||||
cp--, cp2--;
|
||||
if (cp - 1 == to) {
|
||||
/* closest common ancestor is /, so use full pathname */
|
||||
len = strlen(strcpy(outpath, to));
|
||||
if (outpath[len] != '/') {
|
||||
outpath[len++] = '/';
|
||||
outpath[len] = '\0';
|
||||
}
|
||||
} else {
|
||||
len = 0;
|
||||
while ((cp2 = getcomponent(cp2, buf)) != 0) {
|
||||
strcpy(outpath + len, "../");
|
||||
len += 3;
|
||||
}
|
||||
while ((cp = getcomponent(cp, buf)) != 0) {
|
||||
sprintf(outpath + len, "%s/", buf);
|
||||
len += strlen(outpath + len);
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
void
|
||||
reversepath(char *inpath, char *name, int len, char *outpath)
|
||||
{
|
||||
char *cp, *cp2;
|
||||
char buf[NAME_MAX];
|
||||
struct stat sb;
|
||||
|
||||
cp = strcpy(outpath + PATH_MAX - (len + 1), name);
|
||||
cp2 = inpath;
|
||||
while ((cp2 = getcomponent(cp2, buf)) != 0) {
|
||||
if (strcmp(buf, ".") == 0)
|
||||
continue;
|
||||
if (strcmp(buf, "..") == 0) {
|
||||
if (stat(".", &sb) < 0)
|
||||
fail("cannot stat current directory");
|
||||
name = ino2name(sb.st_ino, "..");
|
||||
len = strlen(name);
|
||||
cp -= len + 1;
|
||||
strcpy(cp, name);
|
||||
cp[len] = '/';
|
||||
free(name);
|
||||
xchdir("..");
|
||||
} else {
|
||||
cp -= 3;
|
||||
strncpy(cp, "../", 3);
|
||||
xchdir(buf);
|
||||
}
|
||||
}
|
||||
strcpy(outpath, cp);
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
#!/bin/sh
|
||||
|
||||
prefix=@prefix@
|
||||
|
||||
major_version=@MOD_MAJOR_VERSION@
|
||||
minor_version=@MOD_MINOR_VERSION@
|
||||
patch_version=@MOD_PATCH_VERSION@
|
||||
|
||||
usage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: nspr-config [OPTIONS] [LIBRARIES]
|
||||
Options:
|
||||
[--prefix[=DIR]]
|
||||
[--exec-prefix[=DIR]]
|
||||
[--includedir[=DIR]]
|
||||
[--libdir[=DIR]]
|
||||
[--version]
|
||||
[--libs]
|
||||
[--cflags]
|
||||
Libraries:
|
||||
nspr
|
||||
plc
|
||||
plds
|
||||
EOF
|
||||
exit $1
|
||||
}
|
||||
|
||||
if test $# -eq 0; then
|
||||
usage 1 1>&2
|
||||
fi
|
||||
|
||||
lib_nspr=yes
|
||||
lib_plc=yes
|
||||
lib_plds=yes
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--prefix=*)
|
||||
prefix=$optarg
|
||||
;;
|
||||
--prefix)
|
||||
echo_prefix=yes
|
||||
;;
|
||||
--exec-prefix=*)
|
||||
exec_prefix=$optarg
|
||||
;;
|
||||
--exec-prefix)
|
||||
echo_exec_prefix=yes
|
||||
;;
|
||||
--includedir=*)
|
||||
includedir=$optarg
|
||||
;;
|
||||
--includedir)
|
||||
echo_includedir=yes
|
||||
;;
|
||||
--libdir=*)
|
||||
libdir=$optarg
|
||||
;;
|
||||
--libdir)
|
||||
echo_libdir=yes
|
||||
;;
|
||||
--version)
|
||||
echo ${major_version}.${minor_version}.${patch_version}
|
||||
;;
|
||||
--cflags)
|
||||
echo_cflags=yes
|
||||
;;
|
||||
--libs)
|
||||
echo_libs=yes
|
||||
;;
|
||||
nspr)
|
||||
lib_nspr=yes
|
||||
;;
|
||||
plc)
|
||||
lib_plc=yes
|
||||
;;
|
||||
plds)
|
||||
lib_plds=yes
|
||||
;;
|
||||
*)
|
||||
usage 1 1>&2
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Set variables that may be dependent upon other variables
|
||||
if test -z "$exec_prefix"; then
|
||||
exec_prefix=@exec_prefix@
|
||||
fi
|
||||
if test -z "$includedir"; then
|
||||
includedir=@includedir@
|
||||
fi
|
||||
if test -z "$libdir"; then
|
||||
libdir=@libdir@
|
||||
fi
|
||||
|
||||
if test "$echo_prefix" = "yes"; then
|
||||
echo $prefix
|
||||
fi
|
||||
|
||||
if test "$echo_exec_prefix" = "yes"; then
|
||||
echo $exec_prefix
|
||||
fi
|
||||
|
||||
if test "$echo_includedir" = "yes"; then
|
||||
echo $includedir
|
||||
fi
|
||||
|
||||
if test "$echo_libdir" = "yes"; then
|
||||
echo $libdir
|
||||
fi
|
||||
|
||||
if test "$echo_cflags" = "yes"; then
|
||||
echo -I$includedir
|
||||
fi
|
||||
|
||||
if test "$echo_libs" = "yes"; then
|
||||
libdirs=-L$libdir
|
||||
if test -n "$lib_plds"; then
|
||||
libdirs="$libdirs -lplds${major_version}"
|
||||
fi
|
||||
if test -n "$lib_plc"; then
|
||||
libdirs="$libdirs -lplc${major_version}"
|
||||
fi
|
||||
if test -n "$lib_nspr"; then
|
||||
libdirs="$libdirs -lnspr${major_version}"
|
||||
fi
|
||||
os_ldflags="@LDFLAGS@"
|
||||
for i in $os_ldflags ; do
|
||||
if echo $i | grep \^-L >/dev/null; then
|
||||
libdirs="$libdirs $i"
|
||||
fi
|
||||
done
|
||||
echo $libdirs @OS_LIBS@
|
||||
fi
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
# -*- tab-width: 4; -*-
|
||||
# Configure paths for NSPR
|
||||
# Public domain - Chris Seawood <cls@seawood.org> 2001-04-05
|
||||
# Based upon gtk.m4 (also PD) by Owen Taylor
|
||||
|
||||
dnl AM_PATH_NSPR([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for NSPR, and define NSPR_CFLAGS and NSPR_LIBS
|
||||
AC_DEFUN(AM_PATH_NSPR,
|
||||
[dnl
|
||||
|
||||
AC_ARG_WITH(nspr-prefix,
|
||||
[ --with-nspr-prefix=PFX Prefix where NSPR is installed],
|
||||
nspr_config_prefix="$withval",
|
||||
nspr_config_prefix="")
|
||||
|
||||
AC_ARG_WITH(nspr-exec-prefix,
|
||||
[ --with-nspr-exec-prefix=PFX
|
||||
Exec prefix where NSPR is installed],
|
||||
nspr_config_exec_prefix="$withval",
|
||||
nspr_config_exec_prefix="")
|
||||
|
||||
if test -n "$nspr_config_exec_prefix"; then
|
||||
nspr_config_args="$nspr_config_args --exec-prefix=$nspr_config_exec_prefix"
|
||||
if test -z "$NSPR_CONFIG"; then
|
||||
NSPR_CONFIG=$nspr_config_exec_prefix/bin/nspr-config
|
||||
fi
|
||||
fi
|
||||
if test -n "$nspr_config_prefix"; then
|
||||
nspr_config_args="$nspr_config_args --prefix=$nspr_config_prefix"
|
||||
if test -z "$NSPR_CONFIG"; then
|
||||
NSPR_CONFIG=$nspr_config_prefix/bin/nspr-config
|
||||
fi
|
||||
fi
|
||||
|
||||
unset ac_cv_path_NSPR_CONFIG
|
||||
AC_PATH_PROG(NSPR_CONFIG, nspr-config, no)
|
||||
min_nspr_version=ifelse([$1], ,4.0.0,$1)
|
||||
AC_MSG_CHECKING(for NSPR - version >= $min_nspr_version (skipping))
|
||||
|
||||
no_nspr=""
|
||||
if test "$NSPR_CONFIG" = "no"; then
|
||||
no_nspr="yes"
|
||||
else
|
||||
NSPR_CFLAGS=`$NSPR_CONFIG $nspr_config_args --cflags`
|
||||
NSPR_LIBS=`$NSPR_CONFIG $nspr_config_args --libs`
|
||||
|
||||
dnl Skip version check for now
|
||||
nspr_config_major_version=`$NSPR_CONFIG $nspr_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
nspr_config_minor_version=`$NSPR_CONFIG $nspr_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
nspr_config_micro_version=`$NSPR_CONFIG $nspr_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
fi
|
||||
|
||||
if test -z "$no_nspr"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
|
||||
AC_SUBST(NSPR_CFLAGS)
|
||||
AC_SUBST(NSPR_LIBS)
|
||||
|
||||
])
|
|
@ -0,0 +1,5 @@
|
|||
# Include in Makefiles to define NSPR variables
|
||||
|
||||
NSPR_VERSION = @NSPR_VERSION@
|
||||
NSPR_LIB = -lnspr@NSPR_VERSION@
|
||||
NSPR_EXTRA_LIBS = @EXTRA_LIBS@
|
|
@ -0,0 +1,5 @@
|
|||
# Include in shell scripts to define NSPR variables
|
||||
|
||||
NSPR_VERSION=@NSPR_VERSION@
|
||||
NSPR_LIB=-lnspr$NSPR_VERSION
|
||||
NSPR_EXTRA_LIBS="@EXTRA_LIBS@"
|
|
@ -0,0 +1,78 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef pathsub_h___
|
||||
#define pathsub_h___
|
||||
/*
|
||||
** Pathname subroutines.
|
||||
**
|
||||
** Brendan Eich, 8/29/95
|
||||
*/
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if SUNOS4
|
||||
#include "../pr/include/md/sunos4.h"
|
||||
#endif
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 1024
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Just prevent stupidity
|
||||
*/
|
||||
#undef NAME_MAX
|
||||
#define NAME_MAX 256
|
||||
|
||||
extern char *program;
|
||||
|
||||
extern void fail(char *format, ...);
|
||||
extern char *getcomponent(char *path, char *name);
|
||||
extern char *ino2name(ino_t ino, char *dir);
|
||||
extern void *xmalloc(size_t size);
|
||||
extern char *xstrdup(char *s);
|
||||
extern char *xbasename(char *path);
|
||||
extern void xchdir(char *dir);
|
||||
|
||||
/* Relate absolute pathnames from and to returning the result in outpath. */
|
||||
extern int relatepaths(char *from, char *to, char *outpath);
|
||||
|
||||
/* XXX changes current working directory -- caveat emptor */
|
||||
extern void reversepath(char *inpath, char *name, int len, char *outpath);
|
||||
|
||||
#endif /* pathsub_h___ */
|
|
@ -0,0 +1,44 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* A dummy header file that is a dependency for all the object files.
|
||||
* Used to force a full recompilation of NSPR in Mozilla's Tinderbox
|
||||
* depend builds. See comments in rules.mk.
|
||||
*/
|
||||
|
||||
#error "Do not include this header file."
|
|
@ -0,0 +1,38 @@
|
|||
REM
|
||||
REM ***** BEGIN LICENSE BLOCK *****
|
||||
REM Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
REM
|
||||
REM The contents of this file are subject to the Mozilla Public License Version
|
||||
REM 1.1 (the "License"); you may not use this file except in compliance with
|
||||
REM the License. You may obtain a copy of the License at
|
||||
REM http://www.mozilla.org/MPL/
|
||||
REM
|
||||
REM Software distributed under the License is distributed on an "AS IS" basis,
|
||||
REM WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
REM for the specific language governing rights and limitations under the
|
||||
REM License.
|
||||
REM
|
||||
REM The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
REM
|
||||
REM The Initial Developer of the Original Code is
|
||||
REM Netscape Communications Corporation.
|
||||
REM Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
REM the Initial Developer. All Rights Reserved.
|
||||
REM
|
||||
REM Contributor(s):
|
||||
REM
|
||||
REM Alternatively, the contents of this file may be used under the terms of
|
||||
REM either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
REM the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
REM in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
REM of those above. If you wish to allow use of your version of this file only
|
||||
REM under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
REM use your version of this file under the terms of the MPL, indicate your
|
||||
REM decision by deleting the provisions above and replace them with the notice
|
||||
REM and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
REM the provisions above, a recipient may use your version of this file under
|
||||
REM the terms of any one of the MPL, the GPL or the LGPL.
|
||||
REM
|
||||
REM ***** END LICENSE BLOCK *****
|
||||
|
||||
mkdir %1
|
|
@ -0,0 +1,515 @@
|
|||
#! gmake
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
################################################################################
|
||||
# We used to have a 4 pass build process. Now we do everything in one pass.
|
||||
#
|
||||
# export - Create generated headers and stubs. Publish public headers to
|
||||
# dist/<arch>/include.
|
||||
# Create libraries. Publish libraries to dist/<arch>/lib.
|
||||
# Create programs.
|
||||
#
|
||||
# libs - obsolete. Now a synonym of "export".
|
||||
#
|
||||
# all - the default makefile target. Now a synonym of "export".
|
||||
#
|
||||
# install - Install headers, libraries, and programs on the system.
|
||||
#
|
||||
# Parameters to this makefile (set these before including):
|
||||
#
|
||||
# a)
|
||||
# TARGETS -- the target to create
|
||||
# (defaults to $LIBRARY $PROGRAM)
|
||||
# b)
|
||||
# DIRS -- subdirectories for make to recurse on
|
||||
# (the 'all' rule builds $TARGETS $DIRS)
|
||||
# c)
|
||||
# CSRCS -- .c files to compile
|
||||
# (used to define $OBJS)
|
||||
# d)
|
||||
# PROGRAM -- the target program name to create from $OBJS
|
||||
# ($OBJDIR automatically prepended to it)
|
||||
# e)
|
||||
# LIBRARY -- the target library name to create from $OBJS
|
||||
# ($OBJDIR automatically prepended to it)
|
||||
#
|
||||
################################################################################
|
||||
|
||||
ifndef topsrcdir
|
||||
topsrcdir=$(MOD_DEPTH)
|
||||
endif
|
||||
|
||||
ifndef srcdir
|
||||
srcdir=.
|
||||
endif
|
||||
|
||||
ifndef NSPR_CONFIG_MK
|
||||
include $(topsrcdir)/config/config.mk
|
||||
endif
|
||||
|
||||
ifdef USE_AUTOCONF
|
||||
ifdef CROSS_COMPILE
|
||||
ifdef INTERNAL_TOOLS
|
||||
CC=$(HOST_CC)
|
||||
CCC=$(HOST_CXX)
|
||||
CFLAGS=$(HOST_CFLAGS)
|
||||
CXXFLAGS=$(HOST_CXXFLAGS)
|
||||
LDFLAGS=$(HOST_LDFLAGS)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# This makefile contains rules for building the following kinds of
|
||||
# libraries:
|
||||
# - LIBRARY: a static (archival) library
|
||||
# - SHARED_LIBRARY: a shared (dynamic link) library
|
||||
# - IMPORT_LIBRARY: an import library, used only on Windows and OS/2
|
||||
#
|
||||
# The names of these libraries can be generated by simply specifying
|
||||
# LIBRARY_NAME and LIBRARY_VERSION.
|
||||
#
|
||||
|
||||
ifdef LIBRARY_NAME
|
||||
ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
|
||||
|
||||
#
|
||||
# Win95, Win16, and OS/2 require library names conforming to the 8.3 rule.
|
||||
# other platforms do not.
|
||||
#
|
||||
ifeq (,$(filter-out WIN95 OS2,$(OS_TARGET)))
|
||||
LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
|
||||
SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
|
||||
IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
|
||||
SHARED_LIB_PDB = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
|
||||
else
|
||||
LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
|
||||
SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
|
||||
IMPORT_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
|
||||
SHARED_LIB_PDB = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
|
||||
ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
|
||||
SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_shr.a
|
||||
else
|
||||
ifdef MKSHLIB
|
||||
SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
|
||||
endif
|
||||
endif
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef TARGETS
|
||||
ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
|
||||
TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
|
||||
ifndef BUILD_OPT
|
||||
ifdef MSC_VER
|
||||
ifneq (,$(filter-out 1100 1200,$(MSC_VER)))
|
||||
TARGETS += $(SHARED_LIB_PDB)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
else
|
||||
TARGETS = $(LIBRARY) $(SHARED_LIBRARY)
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# OBJS is the list of object files. It can be constructed by
|
||||
# specifying CSRCS (list of C source files) and ASFILES (list
|
||||
# of assembly language source files).
|
||||
#
|
||||
|
||||
ifndef OBJS
|
||||
OBJS = $(addprefix $(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX))) \
|
||||
$(addprefix $(OBJDIR)/,$(ASFILES:.$(ASM_SUFFIX)=.$(OBJ_SUFFIX)))
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_OS2_TOOLS),VACPP)
|
||||
EXTRA_LIBS := $(patsubst -l%,$(DIST)/lib/%.$(LIB_SUFFIX),$(EXTRA_LIBS))
|
||||
endif
|
||||
|
||||
ALL_TRASH = $(TARGETS) $(OBJS) $(RES) $(filter-out . .., $(OBJDIR)) LOGS TAGS $(GARBAGE) \
|
||||
$(NOSUCHFILE) \
|
||||
so_locations
|
||||
|
||||
ifeq ($(OS_ARCH),OpenVMS)
|
||||
ALL_TRASH += $(wildcard *.c*_defines)
|
||||
ifdef SHARED_LIBRARY
|
||||
VMS_SYMVEC_FILE = $(SHARED_LIBRARY:.$(DLL_SUFFIX)=_symvec.opt)
|
||||
VMS_SYMVEC_FILE_MODULE = $(srcdir)/$(LIBRARY_NAME)_symvec.opt
|
||||
ALL_TRASH += $(VMS_SYMVEC_FILE)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef RELEASE_LIBS_DEST
|
||||
RELEASE_LIBS_DEST = $(RELEASE_LIB_DIR)
|
||||
endif
|
||||
|
||||
ifdef DIRS
|
||||
LOOP_OVER_DIRS = \
|
||||
@for d in $(DIRS); do \
|
||||
if test -d $$d; then \
|
||||
set -e; \
|
||||
echo "cd $$d; $(MAKE) $@"; \
|
||||
$(MAKE) -C $$d $@; \
|
||||
set +e; \
|
||||
else \
|
||||
echo "Skipping non-directory $$d..."; \
|
||||
fi; \
|
||||
done
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
all:: export
|
||||
|
||||
export::
|
||||
+$(LOOP_OVER_DIRS)
|
||||
|
||||
libs:: export
|
||||
|
||||
clean::
|
||||
rm -rf $(OBJS) $(RES) so_locations $(NOSUCHFILE) $(GARBAGE)
|
||||
+$(LOOP_OVER_DIRS)
|
||||
|
||||
clobber::
|
||||
rm -rf $(OBJS) $(RES) $(TARGETS) $(filter-out . ..,$(OBJDIR)) $(GARBAGE) so_locations $(NOSUCHFILE)
|
||||
+$(LOOP_OVER_DIRS)
|
||||
|
||||
realclean clobber_all::
|
||||
rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH)
|
||||
+$(LOOP_OVER_DIRS)
|
||||
|
||||
distclean::
|
||||
rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH) $(DIST_GARBAGE)
|
||||
+$(LOOP_OVER_DIRS)
|
||||
|
||||
install:: $(RELEASE_BINS) $(RELEASE_HEADERS) $(RELEASE_LIBS)
|
||||
ifdef RELEASE_BINS
|
||||
$(NSINSTALL) -t -m 0755 $(RELEASE_BINS) $(DESTDIR)$(bindir)
|
||||
endif
|
||||
ifdef RELEASE_HEADERS
|
||||
$(NSINSTALL) -t -m 0644 $(RELEASE_HEADERS) $(DESTDIR)$(includedir)/$(include_subdir)
|
||||
endif
|
||||
ifdef RELEASE_LIBS
|
||||
$(NSINSTALL) -t -m 0755 $(RELEASE_LIBS) $(DESTDIR)$(libdir)/$(lib_subdir)
|
||||
endif
|
||||
+$(LOOP_OVER_DIRS)
|
||||
|
||||
release:: export
|
||||
ifdef RELEASE_BINS
|
||||
@echo "Copying executable programs and scripts to release directory"
|
||||
@if test -z "$(BUILD_NUMBER)"; then \
|
||||
echo "BUILD_NUMBER must be defined"; \
|
||||
false; \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
@if test ! -d $(RELEASE_BIN_DIR); then \
|
||||
rm -rf $(RELEASE_BIN_DIR); \
|
||||
$(NSINSTALL) -D $(RELEASE_BIN_DIR);\
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
cp $(RELEASE_BINS) $(RELEASE_BIN_DIR)
|
||||
endif
|
||||
ifdef RELEASE_LIBS
|
||||
@echo "Copying libraries to release directory"
|
||||
@if test -z "$(BUILD_NUMBER)"; then \
|
||||
echo "BUILD_NUMBER must be defined"; \
|
||||
false; \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
@if test ! -d $(RELEASE_LIBS_DEST); then \
|
||||
rm -rf $(RELEASE_LIBS_DEST); \
|
||||
$(NSINSTALL) -D $(RELEASE_LIBS_DEST);\
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
cp $(RELEASE_LIBS) $(RELEASE_LIBS_DEST)
|
||||
endif
|
||||
ifdef RELEASE_HEADERS
|
||||
@echo "Copying header files to release directory"
|
||||
@if test -z "$(BUILD_NUMBER)"; then \
|
||||
echo "BUILD_NUMBER must be defined"; \
|
||||
false; \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
@if test ! -d $(RELEASE_HEADERS_DEST); then \
|
||||
rm -rf $(RELEASE_HEADERS_DEST); \
|
||||
$(NSINSTALL) -D $(RELEASE_HEADERS_DEST);\
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
cp $(RELEASE_HEADERS) $(RELEASE_HEADERS_DEST)
|
||||
endif
|
||||
+$(LOOP_OVER_DIRS)
|
||||
|
||||
alltags:
|
||||
rm -f TAGS tags
|
||||
find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs etags -a
|
||||
find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs ctags -a
|
||||
|
||||
$(NFSPWD):
|
||||
cd $(@D); $(MAKE) $(@F)
|
||||
|
||||
$(PROGRAM): $(OBJS)
|
||||
@$(MAKE_OBJDIR)
|
||||
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
|
||||
$(CC) $(OBJS) -Fe$@ -link $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
|
||||
else
|
||||
ifeq ($(MOZ_OS2_TOOLS),VACPP)
|
||||
$(CC) $(OBJS) -Fe$@ $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
|
||||
else
|
||||
$(CC) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS)
|
||||
endif
|
||||
endif
|
||||
ifdef ENABLE_STRIP
|
||||
$(STRIP) $@
|
||||
endif
|
||||
|
||||
$(LIBRARY): $(OBJS)
|
||||
@$(MAKE_OBJDIR)
|
||||
rm -f $@
|
||||
ifeq ($(MOZ_OS2_TOOLS),VACPP)
|
||||
$(AR) $(subst /,\\,$(OBJS)) $(AR_FLAGS)
|
||||
else
|
||||
$(AR) $(AR_FLAGS) $(OBJS) $(AR_EXTRA_ARGS)
|
||||
endif
|
||||
$(RANLIB) $@
|
||||
|
||||
ifeq ($(OS_TARGET), OS2)
|
||||
$(IMPORT_LIBRARY): $(MAPFILE)
|
||||
rm -f $@
|
||||
$(IMPLIB) $@ $(MAPFILE)
|
||||
endif
|
||||
|
||||
$(SHARED_LIBRARY): $(OBJS) $(RES) $(MAPFILE)
|
||||
@$(MAKE_OBJDIR)
|
||||
rm -f $@
|
||||
ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
|
||||
echo "#!" > $(OBJDIR)/lib$(LIBRARY_NAME)_syms
|
||||
nm -B -C -g $(OBJS) \
|
||||
| awk '/ [T,D] / {print $$3}' \
|
||||
| sed -e 's/^\.//' \
|
||||
| sort -u >> $(OBJDIR)/lib$(LIBRARY_NAME)_syms
|
||||
$(LD) $(XCFLAGS) -o $@ $(OBJS) -bE:$(OBJDIR)/lib$(LIBRARY_NAME)_syms \
|
||||
-bM:SRE -bnoentry $(OS_LIBS) $(EXTRA_LIBS)
|
||||
else # AIX 4.1
|
||||
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
|
||||
$(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS) $(RES)
|
||||
else
|
||||
ifeq ($(MOZ_OS2_TOOLS),VACPP)
|
||||
$(LINK_DLL) $(DLLBASE) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS) $(MAPFILE)
|
||||
else # !os2 vacpp
|
||||
ifeq ($(OS_TARGET), OpenVMS)
|
||||
@if test ! -f $(VMS_SYMVEC_FILE); then \
|
||||
if test -f $(VMS_SYMVEC_FILE_MODULE); then \
|
||||
echo Creating component options file $(VMS_SYMVEC_FILE); \
|
||||
cp $(VMS_SYMVEC_FILE_MODULE) $(VMS_SYMVEC_FILE); \
|
||||
fi; \
|
||||
fi
|
||||
endif # OpenVMS
|
||||
$(MKSHLIB) $(OBJS) $(RES) $(EXTRA_LIBS)
|
||||
endif # OS2 vacpp
|
||||
endif # WINNT
|
||||
endif # AIX 4.1
|
||||
ifdef ENABLE_STRIP
|
||||
$(STRIP) $@
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
$(RES): $(RESNAME)
|
||||
@$(MAKE_OBJDIR)
|
||||
# The resource compiler does not understand the -U option.
|
||||
ifdef NS_USE_GCC
|
||||
$(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $<
|
||||
else
|
||||
$(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $<
|
||||
endif # GCC
|
||||
@echo $(RES) finished
|
||||
endif
|
||||
|
||||
$(MAPFILE): $(LIBRARY_NAME).def
|
||||
@$(MAKE_OBJDIR)
|
||||
ifeq ($(OS_ARCH),SunOS)
|
||||
grep -v ';-' $< | \
|
||||
sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
|
||||
endif
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
echo LIBRARY $(LIBRARY_NAME)$(LIBRARY_VERSION) INITINSTANCE TERMINSTANCE > $@
|
||||
echo PROTMODE >> $@
|
||||
echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@
|
||||
echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
|
||||
echo EXPORTS >> $@
|
||||
ifeq ($(MOZ_OS2_TOOLS),VACPP)
|
||||
grep -v ';+' $< | grep -v ';-' | \
|
||||
sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' >> $@
|
||||
else
|
||||
grep -v ';+' $< | grep -v ';-' | \
|
||||
sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' -e 's,\([\t ]*\),\1_,' | \
|
||||
awk 'BEGIN {ord=1;} { print($$0 " @" ord " RESIDENTNAME"); ord++;}' >> $@
|
||||
$(ADD_TO_DEF_FILE)
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# Translate source filenames to absolute paths. This is required for
|
||||
# debuggers under Windows and OS/2 to find source files automatically.
|
||||
#
|
||||
|
||||
ifeq (,$(filter-out AIX OS2,$(OS_ARCH)))
|
||||
NEED_ABSOLUTE_PATH = 1
|
||||
endif
|
||||
|
||||
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
|
||||
NEED_ABSOLUTE_PATH = 1
|
||||
endif
|
||||
|
||||
ifdef NEED_ABSOLUTE_PATH
|
||||
PWD := $(shell pwd)
|
||||
abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
|
||||
endif
|
||||
|
||||
$(OBJDIR)/%.$(OBJ_SUFFIX): %.cpp
|
||||
@$(MAKE_OBJDIR)
|
||||
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
|
||||
$(CCC) -Fo$@ -c $(CCCFLAGS) $(call abspath,$<)
|
||||
else
|
||||
ifeq ($(MOZ_OS2_TOOLS),VACPP)
|
||||
$(CCC) -Fo$@ -c $(CCCFLAGS) $(call abspath,$<)
|
||||
else
|
||||
ifdef NEED_ABSOLUTE_PATH
|
||||
$(CCC) -o $@ -c $(CCCFLAGS) $(call abspath,$<)
|
||||
else
|
||||
$(CCC) -o $@ -c $(CCCFLAGS) $<
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
WCCFLAGS1 = $(subst /,\\,$(CFLAGS))
|
||||
WCCFLAGS2 = $(subst -I,-i=,$(WCCFLAGS1))
|
||||
WCCFLAGS3 = $(subst -D,-d,$(WCCFLAGS2))
|
||||
$(OBJDIR)/%.$(OBJ_SUFFIX): %.c
|
||||
@$(MAKE_OBJDIR)
|
||||
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
|
||||
$(CC) -Fo$@ -c $(CFLAGS) $(call abspath,$<)
|
||||
else
|
||||
ifeq ($(MOZ_OS2_TOOLS),VACPP)
|
||||
$(CC) -Fo$@ -c $(CFLAGS) $(call abspath,$<)
|
||||
else
|
||||
ifdef NEED_ABSOLUTE_PATH
|
||||
$(CC) -o $@ -c $(CFLAGS) $(call abspath,$<)
|
||||
else
|
||||
$(CC) -o $@ -c $(CFLAGS) $<
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
$(OBJDIR)/%.$(OBJ_SUFFIX): %.s
|
||||
@$(MAKE_OBJDIR)
|
||||
$(AS) -o $@ $(ASFLAGS) -c $<
|
||||
|
||||
ifeq ($(MOZ_OS2_TOOLS),VACPP)
|
||||
$(OBJDIR)/%.$(OBJ_SUFFIX): %.asm
|
||||
@$(MAKE_OBJDIR)
|
||||
$(AS) -Fdo:./$(OBJDIR) $(ASFLAGS) $<
|
||||
endif
|
||||
|
||||
%.i: %.c
|
||||
$(CC) -C -E $(CFLAGS) $< > $*.i
|
||||
|
||||
%: %.pl
|
||||
rm -f $@; cp $< $@; chmod +x $@
|
||||
|
||||
#
|
||||
# HACK ALERT
|
||||
#
|
||||
# The only purpose of this rule is to pass Mozilla's Tinderbox depend
|
||||
# builds (http://tinderbox.mozilla.org/showbuilds.cgi). Mozilla's
|
||||
# Tinderbox builds NSPR continuously as part of the Mozilla client.
|
||||
# Because NSPR's make depend is not implemented, whenever we change
|
||||
# an NSPR header file, the depend build does not recompile the NSPR
|
||||
# files that depend on the header.
|
||||
#
|
||||
# This rule makes all the objects depend on a dummy header file.
|
||||
# Touch this dummy header file to force the depend build to recompile
|
||||
# everything.
|
||||
#
|
||||
# This rule should be removed when make depend is implemented.
|
||||
#
|
||||
|
||||
DUMMY_DEPEND_H = $(topsrcdir)/config/prdepend.h
|
||||
|
||||
$(filter $(OBJDIR)/%.$(OBJ_SUFFIX),$(OBJS)): $(OBJDIR)/%.$(OBJ_SUFFIX): $(DUMMY_DEPEND_H)
|
||||
|
||||
# END OF HACK
|
||||
|
||||
################################################################################
|
||||
# Special gmake rules.
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# Re-define the list of default suffixes, so gmake won't have to churn through
|
||||
# hundreds of built-in suffix rules for stuff we don't need.
|
||||
#
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .a .$(OBJ_SUFFIX) .c .cpp .s .h .i .pl
|
||||
|
||||
#
|
||||
# Fake targets. Always run these rules, even if a file/directory with that
|
||||
# name already exists.
|
||||
#
|
||||
.PHONY: all alltags clean export install libs realclean release
|
||||
|
||||
#
|
||||
# List the target pattern of an implicit rule as a dependency of the
|
||||
# special target .PRECIOUS to preserve intermediate files made by
|
||||
# implicit rules whose target patterns match that file's name.
|
||||
# (See GNU Make documentation, Edition 0.51, May 1996, Sec. 10.4,
|
||||
# p. 107.)
|
||||
#
|
||||
.PRECIOUS: $(OBJDIR)/%.$(OBJ_SUFFIX)
|
|
@ -0,0 +1,172 @@
|
|||
Aliases.h
|
||||
arpa/inet.h
|
||||
assert.h
|
||||
bsd/libc.h
|
||||
bsd/syscall.h
|
||||
bstring.h
|
||||
builtin.h
|
||||
c_asm.h
|
||||
cf.h
|
||||
CFBundle.h
|
||||
CFData.h
|
||||
CFDictionary.h
|
||||
CFString.h
|
||||
CFURL.h
|
||||
CodeFragments.h
|
||||
commdlg.h
|
||||
crt_externs.h
|
||||
crypt.h
|
||||
ctype.h
|
||||
descrip.h
|
||||
Devices.h
|
||||
direct.h
|
||||
dirent.h
|
||||
dlfcn.h
|
||||
dl.h
|
||||
DriverServices.h
|
||||
dvidef.h
|
||||
errno.h
|
||||
Errors.h
|
||||
Events.h
|
||||
fcntl.h
|
||||
fibdef.h
|
||||
files.h
|
||||
Files.h
|
||||
float.h
|
||||
Folders.h
|
||||
Gestalt.h
|
||||
getopt.h
|
||||
grp.h
|
||||
ia64/sys/inline.h
|
||||
ifaddrs.h
|
||||
image.h
|
||||
ints.h
|
||||
iodef.h
|
||||
io.h
|
||||
iostream.h
|
||||
kernel/OS.h
|
||||
lib$routines.h
|
||||
limits.h
|
||||
loader.h
|
||||
locale.h
|
||||
LowMem.h
|
||||
MacErrors.h
|
||||
machine/builtins.h
|
||||
machine/clock.h
|
||||
machine/endian.h
|
||||
machine/inline.h
|
||||
mach/mach_init.h
|
||||
mach/mach_host.h
|
||||
mach-o/dyld.h
|
||||
MacTypes.h
|
||||
Math64.h
|
||||
math.h
|
||||
mbstring.h
|
||||
memory.h
|
||||
MixedMode.h
|
||||
model.h
|
||||
mswsock.h
|
||||
Multiprocessing.h
|
||||
mutex.h
|
||||
netdb.h
|
||||
net/if.h
|
||||
netinet/in.h
|
||||
netinet/in_systm.h
|
||||
netinet/tcp.h
|
||||
OpenTptInternet.h
|
||||
OpenTransport.h
|
||||
os2.h
|
||||
OS.h
|
||||
osreldate.h
|
||||
OSUtils.h
|
||||
poll.h
|
||||
PPCToolbox.h
|
||||
Processes.h
|
||||
process.h
|
||||
pthread.h
|
||||
pwd.h
|
||||
QDOffscreen.h
|
||||
Resources.h
|
||||
rld_interface.h
|
||||
rpc/types.h
|
||||
semaphore.h
|
||||
setjmp.h
|
||||
share.h
|
||||
signal.h
|
||||
ssdef.h
|
||||
starlet.h
|
||||
stat.h
|
||||
stdarg.h
|
||||
stddef.h
|
||||
stdio.h
|
||||
stdlib.h
|
||||
string.h
|
||||
stropts.h
|
||||
stsdef.h
|
||||
support/SupportDefs.h
|
||||
support/TLS.h
|
||||
synch.h
|
||||
sys/atomic_op.h
|
||||
syscall.h
|
||||
sys/cfgodm.h
|
||||
sys/file.h
|
||||
sys/filio.h
|
||||
sys/immu.h
|
||||
sys/ioctl.h
|
||||
sys/ipc.h
|
||||
sys/ldr.h
|
||||
sys/locking.h
|
||||
sys/lwp.h
|
||||
sys/mman.h
|
||||
sys/mpctl.h
|
||||
sys/param.h
|
||||
sys/pda.h
|
||||
sys/poll.h
|
||||
sys/prctl.h
|
||||
sys/priv.h
|
||||
sys/procfs.h
|
||||
sys/pstat.h
|
||||
sys/regset.h
|
||||
sys/resource.h
|
||||
sys/sched.h
|
||||
sys/select.h
|
||||
sys/sem.h
|
||||
sys/sendfile.h
|
||||
sys/shm.h
|
||||
sys/socket.h
|
||||
sys/stack.h
|
||||
sys/stat.h
|
||||
sys/statvfs.h
|
||||
sys/syscall.h
|
||||
sys/sysctl.h
|
||||
sys/sysmp.h
|
||||
sys/syssgi.h
|
||||
sys/systeminfo.h
|
||||
sys/timeb.h
|
||||
sys/time.h
|
||||
sys/times.h
|
||||
sys/types.h
|
||||
sys/ucontext.h
|
||||
sys/uio.h
|
||||
sys/utsname.h
|
||||
sys/wait.h
|
||||
task.h
|
||||
TextUtils.h
|
||||
thread.h
|
||||
time.h
|
||||
Timer.h
|
||||
types.h
|
||||
Types.h
|
||||
ucontext.h
|
||||
ucx$inetdef.h
|
||||
ulocks.h
|
||||
unistd.h
|
||||
unix.h
|
||||
unixlib.h
|
||||
utime.h
|
||||
wchar.h
|
||||
winbase.h
|
||||
win/compobj.h
|
||||
windef.h
|
||||
windows.h
|
||||
winsock.h
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
|||
D
|
|
@ -0,0 +1 @@
|
|||
mozilla/nsprpub/include
|
|
@ -0,0 +1 @@
|
|||
:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
|
|
@ -0,0 +1 @@
|
|||
Makefile
|
|
@ -0,0 +1,3 @@
|
|||
/.cvsignore/1.2/Sat May 12 01:02:30 2001//
|
||||
/Makefile.in/1.9/Sun Apr 25 15:00:34 2004//
|
||||
D
|
|
@ -0,0 +1,5 @@
|
|||
A D/ds////
|
||||
A D/libc////
|
||||
A D/msgc////
|
||||
A D/prstreams////
|
||||
A D/tests////
|
|
@ -0,0 +1 @@
|
|||
mozilla/nsprpub/lib
|
|
@ -0,0 +1 @@
|
|||
:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
|
|
@ -0,0 +1,56 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
#! gmake
|
||||
|
||||
MOD_DEPTH = ..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(MOD_DEPTH)/config/autoconf.mk
|
||||
|
||||
export NSPR20=1
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
DIRS = ds libc
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
export:: $(TARGETS)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Makefile
|
||||
_pl_bld.h
|
|
@ -0,0 +1,13 @@
|
|||
/.cvsignore/1.3/Mon May 14 22:12:54 2001//
|
||||
/MANIFEST/1.6/Fri Jan 28 00:27:07 2000//
|
||||
/Makefile.in/1.35/Wed Jun 1 14:28:25 2005//
|
||||
/plarena.c/3.13/Fri Feb 11 18:16:31 2005//
|
||||
/plarena.h/3.6/Sun Oct 19 00:10:22 2003//
|
||||
/plarenas.h/3.6/Sun Apr 25 15:00:35 2004//
|
||||
/plds.def/1.5/Tue Mar 8 03:01:04 2005//
|
||||
/plds.rc/3.6/Sun Apr 25 15:00:35 2004//
|
||||
/plds_symvec.opt/1.2/Wed Jan 15 00:00:12 2003//
|
||||
/plhash.c/3.10/Sun Apr 25 15:00:35 2004//
|
||||
/plhash.h/3.9/Sun Apr 25 15:00:35 2004//
|
||||
/plvrsion.c/3.10/Sun Apr 25 15:00:35 2004//
|
||||
D
|
|
@ -0,0 +1 @@
|
|||
mozilla/nsprpub/lib/ds
|
|
@ -0,0 +1 @@
|
|||
:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
|
|
@ -0,0 +1,7 @@
|
|||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
||||
plarenas.h
|
||||
plarena.h
|
||||
plhash.h
|
|
@ -0,0 +1,202 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
#! gmake
|
||||
|
||||
MOD_DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(MOD_DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include
|
||||
|
||||
CSRCS = \
|
||||
plarena.c \
|
||||
plhash.c \
|
||||
plvrsion.c \
|
||||
$(NULL)
|
||||
|
||||
HEADERS = \
|
||||
plarenas.h \
|
||||
plarena.h \
|
||||
plhash.h \
|
||||
$(NULL)
|
||||
|
||||
HEADERS := $(addprefix $(srcdir)/, $(HEADERS))
|
||||
|
||||
ifeq ($(OS_ARCH), WINNT)
|
||||
ifdef NS_USE_GCC
|
||||
DLLBASE=-Wl,--image-base -Wl,0x30000000
|
||||
else
|
||||
DLLBASE=-BASE:0x30000000
|
||||
endif # GCC
|
||||
RES=$(OBJDIR)/plds.res
|
||||
RESNAME=plds.rc
|
||||
endif # WINNT
|
||||
|
||||
ifeq ($(OS_ARCH), AIX)
|
||||
ifeq ($(CLASSIC_NSPR),1)
|
||||
OS_LIBS = -lc
|
||||
else
|
||||
OS_LIBS = -lc_r
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),IRIX)
|
||||
OS_LIBS = -lc
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),SunOS)
|
||||
OS_LIBS = -lc
|
||||
MAPFILE = $(OBJDIR)/pldsmap.sun
|
||||
GARBAGE += $(MAPFILE)
|
||||
ifdef NS_USE_GCC
|
||||
ifdef GCC_USE_GNU_LD
|
||||
MKSHLIB += -Wl,--version-script,$(MAPFILE)
|
||||
else
|
||||
MKSHLIB += -Wl,-M,$(MAPFILE)
|
||||
endif
|
||||
else
|
||||
MKSHLIB += -M $(MAPFILE)
|
||||
endif
|
||||
# The -R '$ORIGIN' linker option instructs this library to search for its
|
||||
# dependencies in the same directory where it resides.
|
||||
MKSHLIB += -R '$$ORIGIN'
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
MAPFILE = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).def
|
||||
GARBAGE += $(MAPFILE)
|
||||
MKSHLIB += $(MAPFILE)
|
||||
endif
|
||||
|
||||
EXTRA_LIBS = $(LIBNSPR)
|
||||
|
||||
# On NCR and SCOOS, we can't link with extra libraries when
|
||||
# we build a shared library. If we do so, the linker doesn't
|
||||
# complain, but we would run into weird problems at run-time.
|
||||
# Therefore on these platforms, we link just the .o files.
|
||||
ifeq ($(OS_ARCH),NCR)
|
||||
EXTRA_LIBS =
|
||||
endif
|
||||
ifeq ($(OS_ARCH),SCOOS)
|
||||
EXTRA_LIBS =
|
||||
endif
|
||||
|
||||
ifdef RESOLVE_LINK_SYMBOLS
|
||||
EXTRA_LIBS += $(OS_LIBS)
|
||||
endif
|
||||
|
||||
LIBRARY_NAME = plds
|
||||
LIBRARY_VERSION = $(MOD_MAJOR_VERSION)
|
||||
|
||||
RELEASE_HEADERS = $(HEADERS)
|
||||
RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)
|
||||
RELEASE_LIBS = $(TARGETS)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
#
|
||||
# Version information generation (begin)
|
||||
#
|
||||
ECHO = echo
|
||||
TINC = $(OBJDIR)/_pl_bld.h
|
||||
PROD = $(notdir $(SHARED_LIBRARY))
|
||||
NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
|
||||
SH_DATE = $(shell date "+%Y-%m-%d %T")
|
||||
SH_NOW = $(shell $(NOW))
|
||||
|
||||
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
|
||||
SUF = i64
|
||||
else
|
||||
SUF = LL
|
||||
endif
|
||||
|
||||
GARBAGE += $(TINC)
|
||||
|
||||
$(TINC):
|
||||
@$(MAKE_OBJDIR)
|
||||
@$(ECHO) '#define _BUILD_STRING "$(SH_DATE)"' > $(TINC)
|
||||
@if test ! -z "$(SH_NOW)"; then \
|
||||
$(ECHO) '#define _BUILD_TIME $(SH_NOW)$(SUF)' >> $(TINC); \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
@$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC)
|
||||
|
||||
|
||||
$(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC)
|
||||
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
|
||||
$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
|
||||
else
|
||||
ifeq ($(MOZ_OS2_TOOLS), VACPP)
|
||||
$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
|
||||
else
|
||||
$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
|
||||
endif
|
||||
endif
|
||||
#
|
||||
# Version information generation (end)
|
||||
#
|
||||
|
||||
#
|
||||
# The Client build wants the shared libraries in $(dist_bindir),
|
||||
# so we also install them there.
|
||||
#
|
||||
|
||||
export:: $(TARGETS)
|
||||
$(INSTALL) -m 444 $(HEADERS) $(dist_includedir)
|
||||
$(INSTALL) -m 444 $(TARGETS) $(dist_libdir)
|
||||
ifdef SHARED_LIBRARY
|
||||
ifeq ($(OS_ARCH),HP-UX)
|
||||
$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_libdir)
|
||||
$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_bindir)
|
||||
else
|
||||
$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
|
||||
endif
|
||||
endif
|
||||
ifeq ($(MOZ_BITS),16)
|
||||
$(INSTALL) -m 444 $(HEADERS) $(MOZ_INCL)
|
||||
$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib
|
||||
$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin
|
||||
endif
|
||||
|
||||
|
|
@ -0,0 +1,432 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998-2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/*
|
||||
* Lifetime-based fast allocation, inspired by much prior art, including
|
||||
* "Fast Allocation and Deallocation of Memory Based on Object Lifetimes"
|
||||
* David R. Hanson, Software -- Practice and Experience, Vol. 20(1).
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "plarena.h"
|
||||
#include "prmem.h"
|
||||
#include "prbit.h"
|
||||
#include "prlog.h"
|
||||
#include "prlock.h"
|
||||
#include "prinit.h"
|
||||
|
||||
static PLArena *arena_freelist;
|
||||
|
||||
#ifdef PL_ARENAMETER
|
||||
static PLArenaStats *arena_stats_list;
|
||||
|
||||
#define COUNT(pool,what) (pool)->stats.what++
|
||||
#else
|
||||
#define COUNT(pool,what) /* nothing */
|
||||
#endif
|
||||
|
||||
#define PL_ARENA_DEFAULT_ALIGN sizeof(double)
|
||||
|
||||
static PRLock *arenaLock;
|
||||
static PRCallOnceType once;
|
||||
|
||||
/*
|
||||
** InitializeArenas() -- Initialize arena operations.
|
||||
**
|
||||
** InitializeArenas() is called exactly once and only once from
|
||||
** LockArena(). This function creates the arena protection
|
||||
** lock: arenaLock.
|
||||
**
|
||||
** Note: If the arenaLock cannot be created, InitializeArenas()
|
||||
** fails quietly, returning only PR_FAILURE. This percolates up
|
||||
** to the application using the Arena API. He gets no arena
|
||||
** from PL_ArenaAllocate(). It's up to him to fail gracefully
|
||||
** or recover.
|
||||
**
|
||||
*/
|
||||
static PRStatus InitializeArenas( void )
|
||||
{
|
||||
PR_ASSERT( arenaLock == NULL );
|
||||
arenaLock = PR_NewLock();
|
||||
if ( arenaLock == NULL )
|
||||
return PR_FAILURE;
|
||||
else
|
||||
return PR_SUCCESS;
|
||||
} /* end ArenaInitialize() */
|
||||
|
||||
static PRStatus LockArena( void )
|
||||
{
|
||||
PRStatus rc = PR_CallOnce( &once, InitializeArenas );
|
||||
|
||||
if ( PR_FAILURE != rc )
|
||||
PR_Lock( arenaLock );
|
||||
return(rc);
|
||||
} /* end LockArena() */
|
||||
|
||||
static void UnlockArena( void )
|
||||
{
|
||||
PR_Unlock( arenaLock );
|
||||
return;
|
||||
} /* end UnlockArena() */
|
||||
|
||||
PR_IMPLEMENT(void) PL_InitArenaPool(
|
||||
PLArenaPool *pool, const char *name, PRUint32 size, PRUint32 align)
|
||||
{
|
||||
#if defined(XP_MAC)
|
||||
#pragma unused (name)
|
||||
#endif
|
||||
|
||||
if (align == 0)
|
||||
align = PL_ARENA_DEFAULT_ALIGN;
|
||||
pool->mask = PR_BITMASK(PR_CeilingLog2(align));
|
||||
pool->first.next = NULL;
|
||||
pool->first.base = pool->first.avail = pool->first.limit =
|
||||
(PRUword)PL_ARENA_ALIGN(pool, &pool->first + 1);
|
||||
pool->current = &pool->first;
|
||||
pool->arenasize = size;
|
||||
#ifdef PL_ARENAMETER
|
||||
memset(&pool->stats, 0, sizeof pool->stats);
|
||||
pool->stats.name = strdup(name);
|
||||
pool->stats.next = arena_stats_list;
|
||||
arena_stats_list = &pool->stats;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** PL_ArenaAllocate() -- allocate space from an arena pool
|
||||
**
|
||||
** Description: PL_ArenaAllocate() allocates space from an arena
|
||||
** pool.
|
||||
**
|
||||
** First, try to satisfy the request from arenas starting at
|
||||
** pool->current.
|
||||
**
|
||||
** If there is not enough space in the arena pool->current, try
|
||||
** to claim an arena, on a first fit basis, from the global
|
||||
** freelist (arena_freelist).
|
||||
**
|
||||
** If no arena in arena_freelist is suitable, then try to
|
||||
** allocate a new arena from the heap.
|
||||
**
|
||||
** Returns: pointer to allocated space or NULL
|
||||
**
|
||||
** Notes: The original implementation had some difficult to
|
||||
** solve bugs; the code was difficult to read. Sometimes it's
|
||||
** just easier to rewrite it. I did that. larryh.
|
||||
**
|
||||
** See also: bugzilla: 45343.
|
||||
**
|
||||
*/
|
||||
|
||||
PR_IMPLEMENT(void *) PL_ArenaAllocate(PLArenaPool *pool, PRUint32 nb)
|
||||
{
|
||||
PLArena *a;
|
||||
char *rp; /* returned pointer */
|
||||
|
||||
PR_ASSERT((nb & pool->mask) == 0);
|
||||
|
||||
nb = (PRUword)PL_ARENA_ALIGN(pool, nb); /* force alignment */
|
||||
|
||||
/* attempt to allocate from arenas at pool->current */
|
||||
{
|
||||
a = pool->current;
|
||||
do {
|
||||
if ( a->avail +nb <= a->limit ) {
|
||||
pool->current = a;
|
||||
rp = (char *)a->avail;
|
||||
a->avail += nb;
|
||||
return rp;
|
||||
}
|
||||
} while( NULL != (a = a->next) );
|
||||
}
|
||||
|
||||
/* attempt to allocate from arena_freelist */
|
||||
{
|
||||
PLArena *p; /* previous pointer, for unlinking from freelist */
|
||||
|
||||
/* lock the arena_freelist. Make access to the freelist MT-Safe */
|
||||
if ( PR_FAILURE == LockArena())
|
||||
return(0);
|
||||
|
||||
for ( a = arena_freelist, p = NULL; a != NULL ; p = a, a = a->next ) {
|
||||
if ( a->base +nb <= a->limit ) {
|
||||
if ( p == NULL )
|
||||
arena_freelist = a->next;
|
||||
else
|
||||
p->next = a->next;
|
||||
UnlockArena();
|
||||
a->avail = a->base;
|
||||
rp = (char *)a->avail;
|
||||
a->avail += nb;
|
||||
/* the newly allocated arena is linked after pool->current
|
||||
* and becomes pool->current */
|
||||
a->next = pool->current->next;
|
||||
pool->current->next = a;
|
||||
pool->current = a;
|
||||
if ( NULL == pool->first.next )
|
||||
pool->first.next = a;
|
||||
return(rp);
|
||||
}
|
||||
}
|
||||
UnlockArena();
|
||||
}
|
||||
|
||||
/* attempt to allocate from the heap */
|
||||
{
|
||||
PRUint32 sz = PR_MAX(pool->arenasize, nb);
|
||||
sz += sizeof *a + pool->mask; /* header and alignment slop */
|
||||
a = (PLArena*)PR_MALLOC(sz);
|
||||
if ( NULL != a ) {
|
||||
a->limit = (PRUword)a + sz;
|
||||
a->base = a->avail = (PRUword)PL_ARENA_ALIGN(pool, a + 1);
|
||||
rp = (char *)a->avail;
|
||||
a->avail += nb;
|
||||
/* the newly allocated arena is linked after pool->current
|
||||
* and becomes pool->current */
|
||||
a->next = pool->current->next;
|
||||
pool->current->next = a;
|
||||
pool->current = a;
|
||||
if ( NULL == pool->first.next )
|
||||
pool->first.next = a;
|
||||
PL_COUNT_ARENA(pool,++);
|
||||
COUNT(pool, nmallocs);
|
||||
return(rp);
|
||||
}
|
||||
}
|
||||
|
||||
/* we got to here, and there's no memory to allocate */
|
||||
return(NULL);
|
||||
} /* --- end PL_ArenaAllocate() --- */
|
||||
|
||||
PR_IMPLEMENT(void *) PL_ArenaGrow(
|
||||
PLArenaPool *pool, void *p, PRUint32 size, PRUint32 incr)
|
||||
{
|
||||
void *newp;
|
||||
|
||||
PL_ARENA_ALLOCATE(newp, pool, size + incr);
|
||||
if (newp)
|
||||
memcpy(newp, p, size);
|
||||
return newp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free tail arenas linked after head, which may not be the true list head.
|
||||
* Reset pool->current to point to head in case it pointed at a tail arena.
|
||||
*/
|
||||
static void FreeArenaList(PLArenaPool *pool, PLArena *head, PRBool reallyFree)
|
||||
{
|
||||
PLArena **ap, *a;
|
||||
|
||||
ap = &head->next;
|
||||
a = *ap;
|
||||
if (!a)
|
||||
return;
|
||||
|
||||
#ifdef DEBUG
|
||||
do {
|
||||
PR_ASSERT(a->base <= a->avail && a->avail <= a->limit);
|
||||
a->avail = a->base;
|
||||
PL_CLEAR_UNUSED(a);
|
||||
} while ((a = a->next) != 0);
|
||||
a = *ap;
|
||||
#endif
|
||||
|
||||
if (reallyFree) {
|
||||
do {
|
||||
*ap = a->next;
|
||||
PL_CLEAR_ARENA(a);
|
||||
PL_COUNT_ARENA(pool,--);
|
||||
PR_DELETE(a);
|
||||
} while ((a = *ap) != 0);
|
||||
} else {
|
||||
/* Insert the whole arena chain at the front of the freelist. */
|
||||
do {
|
||||
ap = &(*ap)->next;
|
||||
} while (*ap);
|
||||
LockArena();
|
||||
*ap = arena_freelist;
|
||||
arena_freelist = a;
|
||||
head->next = 0;
|
||||
UnlockArena();
|
||||
}
|
||||
|
||||
pool->current = head;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void) PL_ArenaRelease(PLArenaPool *pool, char *mark)
|
||||
{
|
||||
PLArena *a;
|
||||
|
||||
for (a = pool->first.next; a; a = a->next) {
|
||||
if (PR_UPTRDIFF(mark, a->base) < PR_UPTRDIFF(a->avail, a->base)) {
|
||||
a->avail = (PRUword)PL_ARENA_ALIGN(pool, mark);
|
||||
FreeArenaList(pool, a, PR_FALSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void) PL_FreeArenaPool(PLArenaPool *pool)
|
||||
{
|
||||
FreeArenaList(pool, &pool->first, PR_FALSE);
|
||||
COUNT(pool, ndeallocs);
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void) PL_FinishArenaPool(PLArenaPool *pool)
|
||||
{
|
||||
FreeArenaList(pool, &pool->first, PR_TRUE);
|
||||
#ifdef PL_ARENAMETER
|
||||
{
|
||||
PLArenaStats *stats, **statsp;
|
||||
|
||||
if (pool->stats.name)
|
||||
PR_DELETE(pool->stats.name);
|
||||
for (statsp = &arena_stats_list; (stats = *statsp) != 0;
|
||||
statsp = &stats->next) {
|
||||
if (stats == &pool->stats) {
|
||||
*statsp = stats->next;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void) PL_CompactArenaPool(PLArenaPool *ap)
|
||||
{
|
||||
#if XP_MAC
|
||||
#pragma unused (ap)
|
||||
#if 0
|
||||
PRArena *curr = &(ap->first);
|
||||
while (curr) {
|
||||
reallocSmaller(curr, curr->avail - (uprword_t)curr);
|
||||
curr->limit = curr->avail;
|
||||
curr = curr->next;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void) PL_ArenaFinish(void)
|
||||
{
|
||||
PLArena *a, *next;
|
||||
|
||||
for (a = arena_freelist; a; a = next) {
|
||||
next = a->next;
|
||||
PR_DELETE(a);
|
||||
}
|
||||
arena_freelist = NULL;
|
||||
|
||||
if (arenaLock) {
|
||||
PR_DestroyLock(arenaLock);
|
||||
arenaLock = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PL_ARENAMETER
|
||||
PR_IMPLEMENT(void) PL_ArenaCountAllocation(PLArenaPool *pool, PRUint32 nb)
|
||||
{
|
||||
pool->stats.nallocs++;
|
||||
pool->stats.nbytes += nb;
|
||||
if (nb > pool->stats.maxalloc)
|
||||
pool->stats.maxalloc = nb;
|
||||
pool->stats.variance += nb * nb;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void) PL_ArenaCountInplaceGrowth(
|
||||
PLArenaPool *pool, PRUint32 size, PRUint32 incr)
|
||||
{
|
||||
pool->stats.ninplace++;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void) PL_ArenaCountGrowth(
|
||||
PLArenaPool *pool, PRUint32 size, PRUint32 incr)
|
||||
{
|
||||
pool->stats.ngrows++;
|
||||
pool->stats.nbytes += incr;
|
||||
pool->stats.variance -= size * size;
|
||||
size += incr;
|
||||
if (size > pool->stats.maxalloc)
|
||||
pool->stats.maxalloc = size;
|
||||
pool->stats.variance += size * size;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void) PL_ArenaCountRelease(PLArenaPool *pool, char *mark)
|
||||
{
|
||||
pool->stats.nreleases++;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void) PL_ArenaCountRetract(PLArenaPool *pool, char *mark)
|
||||
{
|
||||
pool->stats.nfastrels++;
|
||||
}
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
PR_IMPLEMENT(void) PL_DumpArenaStats(FILE *fp)
|
||||
{
|
||||
PLArenaStats *stats;
|
||||
double mean, variance;
|
||||
|
||||
for (stats = arena_stats_list; stats; stats = stats->next) {
|
||||
if (stats->nallocs != 0) {
|
||||
mean = (double)stats->nbytes / stats->nallocs;
|
||||
variance = fabs(stats->variance / stats->nallocs - mean * mean);
|
||||
} else {
|
||||
mean = variance = 0;
|
||||
}
|
||||
|
||||
fprintf(fp, "\n%s allocation statistics:\n", stats->name);
|
||||
fprintf(fp, " number of arenas: %u\n", stats->narenas);
|
||||
fprintf(fp, " number of allocations: %u\n", stats->nallocs);
|
||||
fprintf(fp, " number of free arena reclaims: %u\n", stats->nreclaims);
|
||||
fprintf(fp, " number of malloc calls: %u\n", stats->nmallocs);
|
||||
fprintf(fp, " number of deallocations: %u\n", stats->ndeallocs);
|
||||
fprintf(fp, " number of allocation growths: %u\n", stats->ngrows);
|
||||
fprintf(fp, " number of in-place growths: %u\n", stats->ninplace);
|
||||
fprintf(fp, "number of released allocations: %u\n", stats->nreleases);
|
||||
fprintf(fp, " number of fast releases: %u\n", stats->nfastrels);
|
||||
fprintf(fp, " total bytes allocated: %u\n", stats->nbytes);
|
||||
fprintf(fp, " mean allocation size: %g\n", mean);
|
||||
fprintf(fp, " standard deviation: %g\n", sqrt(variance));
|
||||
fprintf(fp, " maximum allocation size: %u\n", stats->maxalloc);
|
||||
}
|
||||
}
|
||||
#endif /* PL_ARENAMETER */
|
|
@ -0,0 +1,213 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998-2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef plarena_h___
|
||||
#define plarena_h___
|
||||
/*
|
||||
* Lifetime-based fast allocation, inspired by much prior art, including
|
||||
* "Fast Allocation and Deallocation of Memory Based on Object Lifetimes"
|
||||
* David R. Hanson, Software -- Practice and Experience, Vol. 20(1).
|
||||
*
|
||||
* Also supports LIFO allocation (PL_ARENA_MARK/PL_ARENA_RELEASE).
|
||||
*/
|
||||
#include "prtypes.h"
|
||||
#include "plarenas.h"
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
typedef struct PLArena PLArena;
|
||||
|
||||
struct PLArena {
|
||||
PLArena *next; /* next arena for this lifetime */
|
||||
PRUword base; /* aligned base address, follows this header */
|
||||
PRUword limit; /* one beyond last byte in arena */
|
||||
PRUword avail; /* points to next available byte */
|
||||
};
|
||||
|
||||
#ifdef PL_ARENAMETER
|
||||
typedef struct PLArenaStats PLArenaStats;
|
||||
|
||||
struct PLArenaStats {
|
||||
PLArenaStats *next; /* next in arenaStats list */
|
||||
char *name; /* name for debugging */
|
||||
PRUint32 narenas; /* number of arenas in pool */
|
||||
PRUint32 nallocs; /* number of PL_ARENA_ALLOCATE() calls */
|
||||
PRUint32 nreclaims; /* number of reclaims from freeArenas */
|
||||
PRUint32 nmallocs; /* number of malloc() calls */
|
||||
PRUint32 ndeallocs; /* number of lifetime deallocations */
|
||||
PRUint32 ngrows; /* number of PL_ARENA_GROW() calls */
|
||||
PRUint32 ninplace; /* number of in-place growths */
|
||||
PRUint32 nreleases; /* number of PL_ARENA_RELEASE() calls */
|
||||
PRUint32 nfastrels; /* number of "fast path" releases */
|
||||
PRUint32 nbytes; /* total bytes allocated */
|
||||
PRUint32 maxalloc; /* maximum allocation size in bytes */
|
||||
PRFloat64 variance; /* size variance accumulator */
|
||||
};
|
||||
#endif
|
||||
|
||||
struct PLArenaPool {
|
||||
PLArena first; /* first arena in pool list */
|
||||
PLArena *current; /* arena from which to allocate space */
|
||||
PRUint32 arenasize; /* net exact size of a new arena */
|
||||
PRUword mask; /* alignment mask (power-of-2 - 1) */
|
||||
#ifdef PL_ARENAMETER
|
||||
PLArenaStats stats;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* If the including .c file uses only one power-of-2 alignment, it may define
|
||||
* PL_ARENA_CONST_ALIGN_MASK to the alignment mask and save a few instructions
|
||||
* per ALLOCATE and GROW.
|
||||
*/
|
||||
#ifdef PL_ARENA_CONST_ALIGN_MASK
|
||||
#define PL_ARENA_ALIGN(pool, n) (((PRUword)(n) + PL_ARENA_CONST_ALIGN_MASK) \
|
||||
& ~PL_ARENA_CONST_ALIGN_MASK)
|
||||
|
||||
#define PL_INIT_ARENA_POOL(pool, name, size) \
|
||||
PL_InitArenaPool(pool, name, size, PL_ARENA_CONST_ALIGN_MASK + 1)
|
||||
#else
|
||||
#define PL_ARENA_ALIGN(pool, n) (((PRUword)(n) + (pool)->mask) & ~(pool)->mask)
|
||||
#endif
|
||||
|
||||
#define PL_ARENA_ALLOCATE(p, pool, nb) \
|
||||
PR_BEGIN_MACRO \
|
||||
PLArena *_a = (pool)->current; \
|
||||
PRUint32 _nb = PL_ARENA_ALIGN(pool, nb); \
|
||||
PRUword _p = _a->avail; \
|
||||
PRUword _q = _p + _nb; \
|
||||
if (_q > _a->limit) \
|
||||
_p = (PRUword)PL_ArenaAllocate(pool, _nb); \
|
||||
else \
|
||||
_a->avail = _q; \
|
||||
p = (void *)_p; \
|
||||
PL_ArenaCountAllocation(pool, nb); \
|
||||
PR_END_MACRO
|
||||
|
||||
#define PL_ARENA_GROW(p, pool, size, incr) \
|
||||
PR_BEGIN_MACRO \
|
||||
PLArena *_a = (pool)->current; \
|
||||
PRUint32 _incr = PL_ARENA_ALIGN(pool, incr); \
|
||||
PRUword _p = _a->avail; \
|
||||
PRUword _q = _p + _incr; \
|
||||
if (_p == (PRUword)(p) + PL_ARENA_ALIGN(pool, size) && \
|
||||
_q <= _a->limit) { \
|
||||
_a->avail = _q; \
|
||||
PL_ArenaCountInplaceGrowth(pool, size, incr); \
|
||||
} else { \
|
||||
p = PL_ArenaGrow(pool, p, size, incr); \
|
||||
} \
|
||||
PL_ArenaCountGrowth(pool, size, incr); \
|
||||
PR_END_MACRO
|
||||
|
||||
#define PL_ARENA_MARK(pool) ((void *) (pool)->current->avail)
|
||||
#define PR_UPTRDIFF(p,q) ((PRUword)(p) - (PRUword)(q))
|
||||
|
||||
#ifdef DEBUG
|
||||
#define PL_FREE_PATTERN 0xDA
|
||||
#define PL_CLEAR_UNUSED(a) (PR_ASSERT((a)->avail <= (a)->limit), \
|
||||
memset((void*)(a)->avail, PL_FREE_PATTERN, \
|
||||
(a)->limit - (a)->avail))
|
||||
#define PL_CLEAR_ARENA(a) memset((void*)(a), PL_FREE_PATTERN, \
|
||||
(a)->limit - (PRUword)(a))
|
||||
#else
|
||||
#define PL_CLEAR_UNUSED(a)
|
||||
#define PL_CLEAR_ARENA(a)
|
||||
#endif
|
||||
|
||||
#define PL_ARENA_RELEASE(pool, mark) \
|
||||
PR_BEGIN_MACRO \
|
||||
char *_m = (char *)(mark); \
|
||||
PLArena *_a = (pool)->current; \
|
||||
if (PR_UPTRDIFF(_m, _a->base) <= PR_UPTRDIFF(_a->avail, _a->base)) { \
|
||||
_a->avail = (PRUword)PL_ARENA_ALIGN(pool, _m); \
|
||||
PL_CLEAR_UNUSED(_a); \
|
||||
PL_ArenaCountRetract(pool, _m); \
|
||||
} else { \
|
||||
PL_ArenaRelease(pool, _m); \
|
||||
} \
|
||||
PL_ArenaCountRelease(pool, _m); \
|
||||
PR_END_MACRO
|
||||
|
||||
#ifdef PL_ARENAMETER
|
||||
#define PL_COUNT_ARENA(pool,op) ((pool)->stats.narenas op)
|
||||
#else
|
||||
#define PL_COUNT_ARENA(pool,op)
|
||||
#endif
|
||||
|
||||
#define PL_ARENA_DESTROY(pool, a, pnext) \
|
||||
PR_BEGIN_MACRO \
|
||||
PL_COUNT_ARENA(pool,--); \
|
||||
if ((pool)->current == (a)) (pool)->current = &(pool)->first; \
|
||||
*(pnext) = (a)->next; \
|
||||
PL_CLEAR_ARENA(a); \
|
||||
free(a); \
|
||||
(a) = 0; \
|
||||
PR_END_MACRO
|
||||
|
||||
#ifdef PL_ARENAMETER
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
PR_EXTERN(void) PL_ArenaCountAllocation(PLArenaPool *pool, PRUint32 nb);
|
||||
|
||||
PR_EXTERN(void) PL_ArenaCountInplaceGrowth(
|
||||
PLArenaPool *pool, PRUint32 size, PRUint32 incr);
|
||||
|
||||
PR_EXTERN(void) PL_ArenaCountGrowth(
|
||||
PLArenaPool *pool, PRUint32 size, PRUint32 incr);
|
||||
|
||||
PR_EXTERN(void) PL_ArenaCountRelease(PLArenaPool *pool, char *mark);
|
||||
|
||||
PR_EXTERN(void) PL_ArenaCountRetract(PLArenaPool *pool, char *mark);
|
||||
|
||||
PR_EXTERN(void) PL_DumpArenaStats(FILE *fp);
|
||||
|
||||
#else /* !PL_ARENAMETER */
|
||||
|
||||
#define PL_ArenaCountAllocation(ap, nb) /* nothing */
|
||||
#define PL_ArenaCountInplaceGrowth(ap, size, incr) /* nothing */
|
||||
#define PL_ArenaCountGrowth(ap, size, incr) /* nothing */
|
||||
#define PL_ArenaCountRelease(ap, mark) /* nothing */
|
||||
#define PL_ArenaCountRetract(ap, mark) /* nothing */
|
||||
|
||||
#endif /* !PL_ARENAMETER */
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
#endif /* plarena_h___ */
|
|
@ -0,0 +1,115 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#if defined(PLARENAS_H)
|
||||
#else /* defined(PLARENAS_H) */
|
||||
#define PLARENAS_H
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
typedef struct PLArenaPool PLArenaPool;
|
||||
|
||||
/*
|
||||
** Allocate an arena pool as specified by the parameters.
|
||||
**
|
||||
** This is equivelant to allocating the space yourself and then
|
||||
** calling PL_InitArenaPool().
|
||||
**
|
||||
** This function may fail (and return a NULL) for a variety of
|
||||
** reasons. The reason for a particular failure can be discovered
|
||||
** by calling PR_GetError().
|
||||
*/
|
||||
#if 0 /* Not implemented */
|
||||
PR_EXTERN(PLArenaPool*) PL_AllocArenaPool(
|
||||
const char *name, PRUint32 size, PRUint32 align);
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Destroy an arena pool previously allocated by PL_AllocArenaPool().
|
||||
**
|
||||
** This function may fail if the arena is not empty and the caller
|
||||
** wishes to check for empty upon descruction.
|
||||
*/
|
||||
#if 0 /* Not implemented */
|
||||
PR_EXTERN(PRStatus) PL_DestroyArenaPool(PLArenaPool *pool, PRBool checkEmpty);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** Initialize an arena pool with the given name for debugging and metering,
|
||||
** with a minimum size per arena of size bytes.
|
||||
**/
|
||||
PR_EXTERN(void) PL_InitArenaPool(
|
||||
PLArenaPool *pool, const char *name, PRUint32 size, PRUint32 align);
|
||||
|
||||
/*
|
||||
** Finish using arenas, freeing all memory associated with them.
|
||||
**/
|
||||
PR_EXTERN(void) PL_ArenaFinish(void);
|
||||
|
||||
/*
|
||||
** Free the arenas in pool. The user may continue to allocate from pool
|
||||
** after calling this function. There is no need to call PL_InitArenaPool()
|
||||
** again unless PL_FinishArenaPool(pool) has been called.
|
||||
**/
|
||||
PR_EXTERN(void) PL_FreeArenaPool(PLArenaPool *pool);
|
||||
|
||||
/*
|
||||
** Free the arenas in pool and finish using it altogether.
|
||||
**/
|
||||
PR_EXTERN(void) PL_FinishArenaPool(PLArenaPool *pool);
|
||||
|
||||
/*
|
||||
** Compact all of the arenas in a pool so that no space is wasted.
|
||||
**/
|
||||
PR_EXTERN(void) PL_CompactArenaPool(PLArenaPool *pool);
|
||||
|
||||
/*
|
||||
** Friend functions used by the PL_ARENA_*() macros.
|
||||
**/
|
||||
PR_EXTERN(void *) PL_ArenaAllocate(PLArenaPool *pool, PRUint32 nb);
|
||||
|
||||
PR_EXTERN(void *) PL_ArenaGrow(
|
||||
PLArenaPool *pool, void *p, PRUint32 size, PRUint32 incr);
|
||||
|
||||
PR_EXTERN(void) PL_ArenaRelease(PLArenaPool *pool, char *mark);
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
#endif /* defined(PLARENAS_H) */
|
||||
|
||||
/* plarenas */
|
|
@ -0,0 +1,83 @@
|
|||
;+#
|
||||
;+# ***** BEGIN LICENSE BLOCK *****
|
||||
;+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
;+#
|
||||
;+# The contents of this file are subject to the Mozilla Public License Version
|
||||
;+# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
;+# the License. You may obtain a copy of the License at
|
||||
;+# http://www.mozilla.org/MPL/
|
||||
;+#
|
||||
;+# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
;+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
;+# for the specific language governing rights and limitations under the
|
||||
;+# License.
|
||||
;+#
|
||||
;+# The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
;+#
|
||||
;+# The Initial Developer of the Original Code is
|
||||
;+# Netscape Communications Corporation.
|
||||
;+# Portions created by the Initial Developer are Copyright (C) 2002-2003
|
||||
;+# the Initial Developer. All Rights Reserved.
|
||||
;+#
|
||||
;+# Contributor(s):
|
||||
;+#
|
||||
;+# Alternatively, the contents of this file may be used under the terms of
|
||||
;+# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
;+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
;+# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
;+# of those above. If you wish to allow use of your version of this file only
|
||||
;+# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
;+# use your version of this file under the terms of the MPL, indicate your
|
||||
;+# decision by deleting the provisions above and replace them with the notice
|
||||
;+# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
;+# the provisions above, a recipient may use your version of this file under
|
||||
;+# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
;+#
|
||||
;+# ***** END LICENSE BLOCK *****
|
||||
;+#
|
||||
;+# OK, this file is meant to support SUN, LINUX, AIX, OS/2 and WINDOWS
|
||||
;+# 1. For all unix platforms, the string ";-" means "remove this line"
|
||||
;+# 2. For all unix platforms, the string " DATA " will be removed from any
|
||||
;+# line on which it occurs.
|
||||
;+# 3. Lines containing ";+" will have ";+" removed on SUN and LINUX.
|
||||
;+# On AIX, lines containing ";+" will be removed.
|
||||
;+# 4. For all unix platforms, the string ";;" will thave the ";;" removed.
|
||||
;+# 5. For all unix platforms, after the above processing has taken place,
|
||||
;+# all characters after the first ";" on the line will be removed.
|
||||
;+# And for AIX, the first ";" will also be removed.
|
||||
;+# This file is passed directly to windows. Since ';' is a comment, all UNIX
|
||||
;+# directives are hidden behind ";", ";+", and ";-"
|
||||
;+NSPR_4.0 {
|
||||
;+ global:
|
||||
LIBRARY plds4 ;-
|
||||
EXPORTS ;-
|
||||
PL_ArenaAllocate;
|
||||
PL_ArenaFinish;
|
||||
PL_ArenaGrow;
|
||||
PL_ArenaRelease;
|
||||
PL_CompactArenaPool;
|
||||
PL_CompareStrings;
|
||||
PL_CompareValues;
|
||||
PL_FinishArenaPool;
|
||||
PL_FreeArenaPool;
|
||||
PL_HashString;
|
||||
PL_HashTableAdd;
|
||||
PL_HashTableDestroy;
|
||||
PL_HashTableDump;
|
||||
PL_HashTableEnumerateEntries;
|
||||
PL_HashTableLookup;
|
||||
PL_HashTableRawAdd;
|
||||
PL_HashTableRawLookup;
|
||||
PL_HashTableRawRemove;
|
||||
PL_HashTableRemove;
|
||||
PL_InitArenaPool;
|
||||
PL_NewHashTable;
|
||||
libVersionPoint;
|
||||
;+ local: *;
|
||||
;+};
|
||||
;+
|
||||
;+NSPR_4.1 {
|
||||
;+ global:
|
||||
PL_HashTableLookupConst;
|
||||
PL_HashTableRawLookupConst;
|
||||
;+} NSPR_4.0;
|
|
@ -0,0 +1,102 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "prinit.h"
|
||||
#include <winver.h>
|
||||
|
||||
#define MY_LIBNAME "plds"
|
||||
#define MY_FILEDESCRIPTION "PLDS Library"
|
||||
|
||||
#define STRINGIZE(x) #x
|
||||
#define STRINGIZE2(x) STRINGIZE(x)
|
||||
#define PR_VMAJOR_STR STRINGIZE2(PR_VMAJOR)
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define MY_DEBUG_STR " (debug)"
|
||||
#define MY_FILEFLAGS_1 VS_FF_DEBUG
|
||||
#else
|
||||
#define MY_DEBUG_STR ""
|
||||
#define MY_FILEFLAGS_1 0x0L
|
||||
#endif
|
||||
#if PR_BETA
|
||||
#define MY_FILEFLAGS_2 MY_FILEFLAGS_1|VS_FF_PRERELEASE
|
||||
#else
|
||||
#define MY_FILEFLAGS_2 MY_FILEFLAGS_1
|
||||
#endif
|
||||
|
||||
#ifdef WINNT
|
||||
#define MY_FILEOS VOS_NT_WINDOWS32
|
||||
#define MY_INTERNAL_NAME "lib" MY_LIBNAME PR_VMAJOR_STR
|
||||
#else
|
||||
#define MY_FILEOS VOS__WINDOWS32
|
||||
#define MY_INTERNAL_NAME MY_LIBNAME PR_VMAJOR_STR
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version-information resource
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION PR_VMAJOR,PR_VMINOR,PR_VPATCH,0
|
||||
PRODUCTVERSION PR_VMAJOR,PR_VMINOR,PR_VPATCH,0
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
FILEFLAGS MY_FILEFLAGS_2
|
||||
FILEOS MY_FILEOS
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE 0x0L // not used
|
||||
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904B0" // Lang=US English, CharSet=Unicode
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Netscape Communications Corporation\0"
|
||||
VALUE "FileDescription", MY_FILEDESCRIPTION MY_DEBUG_STR "\0"
|
||||
VALUE "FileVersion", PR_VERSION "\0"
|
||||
VALUE "InternalName", MY_INTERNAL_NAME "\0"
|
||||
VALUE "LegalCopyright", "Copyright \251 1996-2000 Netscape Communications Corporation\0"
|
||||
VALUE "OriginalFilename", MY_INTERNAL_NAME ".dll\0"
|
||||
VALUE "ProductName", "Netscape Portable Runtime\0"
|
||||
VALUE "ProductVersion", PR_VERSION "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
|
@ -0,0 +1,37 @@
|
|||
! Fixed section of symbol vector for LIBPLDS4
|
||||
!
|
||||
GSMATCH=LEQUAL,2,2
|
||||
case_sensitive=YES
|
||||
!
|
||||
! --------------------------------------------------------------------------
|
||||
! Ident 2,2 introduced for Mozilla 1.3
|
||||
! Previously this was empty. Now we include everything that's specified in
|
||||
! plds.def.
|
||||
! --------------------------------------------------------------------------
|
||||
!
|
||||
! NSPR 4.0
|
||||
SYMBOL_VECTOR=(PL_ArenaAllocate=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_ArenaFinish=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_ArenaGrow=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_ArenaRelease=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_CompactArenaPool=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_CompareStrings=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_CompareValues=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_FinishArenaPool=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_FreeArenaPool=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_HashString=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_HashTableAdd=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_HashTableDestroy=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_HashTableDump=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_HashTableEnumerateEntries=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_HashTableLookup=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_HashTableRawAdd=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_HashTableRawLookup=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_HashTableRawRemove=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_HashTableRemove=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_InitArenaPool=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_NewHashTable=PROCEDURE)
|
||||
SYMBOL_VECTOR=(libVersionPoint=PROCEDURE)
|
||||
! NSPR 4.1
|
||||
SYMBOL_VECTOR=(PL_HashTableLookupConst=PROCEDURE)
|
||||
SYMBOL_VECTOR=(PL_HashTableRawLookupConst=PROCEDURE)
|
|
@ -0,0 +1,541 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* PL hash table package.
|
||||
*/
|
||||
#include "plhash.h"
|
||||
#include "prbit.h"
|
||||
#include "prlog.h"
|
||||
#include "prmem.h"
|
||||
#include "prtypes.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Compute the number of buckets in ht */
|
||||
#define NBUCKETS(ht) (1 << (PL_HASH_BITS - (ht)->shift))
|
||||
|
||||
/* The smallest table has 16 buckets */
|
||||
#define MINBUCKETSLOG2 4
|
||||
#define MINBUCKETS (1 << MINBUCKETSLOG2)
|
||||
|
||||
/* Compute the maximum entries given n buckets that we will tolerate, ~90% */
|
||||
#define OVERLOADED(n) ((n) - ((n) >> 3))
|
||||
|
||||
/* Compute the number of entries below which we shrink the table by half */
|
||||
#define UNDERLOADED(n) (((n) > MINBUCKETS) ? ((n) >> 2) : 0)
|
||||
|
||||
/*
|
||||
** Stubs for default hash allocator ops.
|
||||
*/
|
||||
static void * PR_CALLBACK
|
||||
DefaultAllocTable(void *pool, PRSize size)
|
||||
{
|
||||
#if defined(XP_MAC)
|
||||
#pragma unused (pool)
|
||||
#endif
|
||||
|
||||
return PR_MALLOC(size);
|
||||
}
|
||||
|
||||
static void PR_CALLBACK
|
||||
DefaultFreeTable(void *pool, void *item)
|
||||
{
|
||||
#if defined(XP_MAC)
|
||||
#pragma unused (pool)
|
||||
#endif
|
||||
|
||||
PR_Free(item);
|
||||
}
|
||||
|
||||
static PLHashEntry * PR_CALLBACK
|
||||
DefaultAllocEntry(void *pool, const void *key)
|
||||
{
|
||||
#if defined(XP_MAC)
|
||||
#pragma unused (pool,key)
|
||||
#endif
|
||||
|
||||
return PR_NEW(PLHashEntry);
|
||||
}
|
||||
|
||||
static void PR_CALLBACK
|
||||
DefaultFreeEntry(void *pool, PLHashEntry *he, PRUintn flag)
|
||||
{
|
||||
#if defined(XP_MAC)
|
||||
#pragma unused (pool)
|
||||
#endif
|
||||
|
||||
if (flag == HT_FREE_ENTRY)
|
||||
PR_Free(he);
|
||||
}
|
||||
|
||||
static PLHashAllocOps defaultHashAllocOps = {
|
||||
DefaultAllocTable, DefaultFreeTable,
|
||||
DefaultAllocEntry, DefaultFreeEntry
|
||||
};
|
||||
|
||||
PR_IMPLEMENT(PLHashTable *)
|
||||
PL_NewHashTable(PRUint32 n, PLHashFunction keyHash,
|
||||
PLHashComparator keyCompare, PLHashComparator valueCompare,
|
||||
const PLHashAllocOps *allocOps, void *allocPriv)
|
||||
{
|
||||
PLHashTable *ht;
|
||||
PRSize nb;
|
||||
|
||||
if (n <= MINBUCKETS) {
|
||||
n = MINBUCKETSLOG2;
|
||||
} else {
|
||||
n = PR_CeilingLog2(n);
|
||||
if ((PRInt32)n < 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!allocOps) allocOps = &defaultHashAllocOps;
|
||||
|
||||
ht = (PLHashTable*)((*allocOps->allocTable)(allocPriv, sizeof *ht));
|
||||
if (!ht)
|
||||
return 0;
|
||||
memset(ht, 0, sizeof *ht);
|
||||
ht->shift = PL_HASH_BITS - n;
|
||||
n = 1 << n;
|
||||
#if defined(WIN16)
|
||||
if (n > 16000) {
|
||||
(*allocOps->freeTable)(allocPriv, ht);
|
||||
return 0;
|
||||
}
|
||||
#endif /* WIN16 */
|
||||
nb = n * sizeof(PLHashEntry *);
|
||||
ht->buckets = (PLHashEntry**)((*allocOps->allocTable)(allocPriv, nb));
|
||||
if (!ht->buckets) {
|
||||
(*allocOps->freeTable)(allocPriv, ht);
|
||||
return 0;
|
||||
}
|
||||
memset(ht->buckets, 0, nb);
|
||||
|
||||
ht->keyHash = keyHash;
|
||||
ht->keyCompare = keyCompare;
|
||||
ht->valueCompare = valueCompare;
|
||||
ht->allocOps = allocOps;
|
||||
ht->allocPriv = allocPriv;
|
||||
return ht;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
PL_HashTableDestroy(PLHashTable *ht)
|
||||
{
|
||||
PRUint32 i, n;
|
||||
PLHashEntry *he, *next;
|
||||
const PLHashAllocOps *allocOps = ht->allocOps;
|
||||
void *allocPriv = ht->allocPriv;
|
||||
|
||||
n = NBUCKETS(ht);
|
||||
for (i = 0; i < n; i++) {
|
||||
for (he = ht->buckets[i]; he; he = next) {
|
||||
next = he->next;
|
||||
(*allocOps->freeEntry)(allocPriv, he, HT_FREE_ENTRY);
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
memset(ht->buckets, 0xDB, n * sizeof ht->buckets[0]);
|
||||
#endif
|
||||
(*allocOps->freeTable)(allocPriv, ht->buckets);
|
||||
#ifdef DEBUG
|
||||
memset(ht, 0xDB, sizeof *ht);
|
||||
#endif
|
||||
(*allocOps->freeTable)(allocPriv, ht);
|
||||
}
|
||||
|
||||
/*
|
||||
** Multiplicative hash, from Knuth 6.4.
|
||||
*/
|
||||
#define GOLDEN_RATIO 0x9E3779B9U /* 2/(1+sqrt(5))*(2^32) */
|
||||
|
||||
PR_IMPLEMENT(PLHashEntry **)
|
||||
PL_HashTableRawLookup(PLHashTable *ht, PLHashNumber keyHash, const void *key)
|
||||
{
|
||||
PLHashEntry *he, **hep, **hep0;
|
||||
PLHashNumber h;
|
||||
|
||||
#ifdef HASHMETER
|
||||
ht->nlookups++;
|
||||
#endif
|
||||
h = keyHash * GOLDEN_RATIO;
|
||||
h >>= ht->shift;
|
||||
hep = hep0 = &ht->buckets[h];
|
||||
while ((he = *hep) != 0) {
|
||||
if (he->keyHash == keyHash && (*ht->keyCompare)(key, he->key)) {
|
||||
/* Move to front of chain if not already there */
|
||||
if (hep != hep0) {
|
||||
*hep = he->next;
|
||||
he->next = *hep0;
|
||||
*hep0 = he;
|
||||
}
|
||||
return hep0;
|
||||
}
|
||||
hep = &he->next;
|
||||
#ifdef HASHMETER
|
||||
ht->nsteps++;
|
||||
#endif
|
||||
}
|
||||
return hep;
|
||||
}
|
||||
|
||||
/*
|
||||
** Same as PL_HashTableRawLookup but doesn't reorder the hash entries.
|
||||
*/
|
||||
PR_IMPLEMENT(PLHashEntry **)
|
||||
PL_HashTableRawLookupConst(PLHashTable *ht, PLHashNumber keyHash,
|
||||
const void *key)
|
||||
{
|
||||
PLHashEntry *he, **hep;
|
||||
PLHashNumber h;
|
||||
|
||||
#ifdef HASHMETER
|
||||
ht->nlookups++;
|
||||
#endif
|
||||
h = keyHash * GOLDEN_RATIO;
|
||||
h >>= ht->shift;
|
||||
hep = &ht->buckets[h];
|
||||
while ((he = *hep) != 0) {
|
||||
if (he->keyHash == keyHash && (*ht->keyCompare)(key, he->key)) {
|
||||
break;
|
||||
}
|
||||
hep = &he->next;
|
||||
#ifdef HASHMETER
|
||||
ht->nsteps++;
|
||||
#endif
|
||||
}
|
||||
return hep;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PLHashEntry *)
|
||||
PL_HashTableRawAdd(PLHashTable *ht, PLHashEntry **hep,
|
||||
PLHashNumber keyHash, const void *key, void *value)
|
||||
{
|
||||
PRUint32 i, n;
|
||||
PLHashEntry *he, *next, **oldbuckets;
|
||||
PRSize nb;
|
||||
|
||||
/* Grow the table if it is overloaded */
|
||||
n = NBUCKETS(ht);
|
||||
if (ht->nentries >= OVERLOADED(n)) {
|
||||
oldbuckets = ht->buckets;
|
||||
#if defined(WIN16)
|
||||
if (2 * n > 16000)
|
||||
return 0;
|
||||
#endif /* WIN16 */
|
||||
nb = 2 * n * sizeof(PLHashEntry *);
|
||||
ht->buckets = (PLHashEntry**)
|
||||
((*ht->allocOps->allocTable)(ht->allocPriv, nb));
|
||||
if (!ht->buckets) {
|
||||
ht->buckets = oldbuckets;
|
||||
return 0;
|
||||
}
|
||||
memset(ht->buckets, 0, nb);
|
||||
#ifdef HASHMETER
|
||||
ht->ngrows++;
|
||||
#endif
|
||||
ht->shift--;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
for (he = oldbuckets[i]; he; he = next) {
|
||||
next = he->next;
|
||||
hep = PL_HashTableRawLookup(ht, he->keyHash, he->key);
|
||||
PR_ASSERT(*hep == 0);
|
||||
he->next = 0;
|
||||
*hep = he;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
memset(oldbuckets, 0xDB, n * sizeof oldbuckets[0]);
|
||||
#endif
|
||||
(*ht->allocOps->freeTable)(ht->allocPriv, oldbuckets);
|
||||
hep = PL_HashTableRawLookup(ht, keyHash, key);
|
||||
}
|
||||
|
||||
/* Make a new key value entry */
|
||||
he = (*ht->allocOps->allocEntry)(ht->allocPriv, key);
|
||||
if (!he)
|
||||
return 0;
|
||||
he->keyHash = keyHash;
|
||||
he->key = key;
|
||||
he->value = value;
|
||||
he->next = *hep;
|
||||
*hep = he;
|
||||
ht->nentries++;
|
||||
return he;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PLHashEntry *)
|
||||
PL_HashTableAdd(PLHashTable *ht, const void *key, void *value)
|
||||
{
|
||||
PLHashNumber keyHash;
|
||||
PLHashEntry *he, **hep;
|
||||
|
||||
keyHash = (*ht->keyHash)(key);
|
||||
hep = PL_HashTableRawLookup(ht, keyHash, key);
|
||||
if ((he = *hep) != 0) {
|
||||
/* Hit; see if values match */
|
||||
if ((*ht->valueCompare)(he->value, value)) {
|
||||
/* key,value pair is already present in table */
|
||||
return he;
|
||||
}
|
||||
if (he->value)
|
||||
(*ht->allocOps->freeEntry)(ht->allocPriv, he, HT_FREE_VALUE);
|
||||
he->value = value;
|
||||
return he;
|
||||
}
|
||||
return PL_HashTableRawAdd(ht, hep, keyHash, key, value);
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
PL_HashTableRawRemove(PLHashTable *ht, PLHashEntry **hep, PLHashEntry *he)
|
||||
{
|
||||
PRUint32 i, n;
|
||||
PLHashEntry *next, **oldbuckets;
|
||||
PRSize nb;
|
||||
|
||||
*hep = he->next;
|
||||
(*ht->allocOps->freeEntry)(ht->allocPriv, he, HT_FREE_ENTRY);
|
||||
|
||||
/* Shrink table if it's underloaded */
|
||||
n = NBUCKETS(ht);
|
||||
if (--ht->nentries < UNDERLOADED(n)) {
|
||||
oldbuckets = ht->buckets;
|
||||
nb = n * sizeof(PLHashEntry*) / 2;
|
||||
ht->buckets = (PLHashEntry**)(
|
||||
(*ht->allocOps->allocTable)(ht->allocPriv, nb));
|
||||
if (!ht->buckets) {
|
||||
ht->buckets = oldbuckets;
|
||||
return;
|
||||
}
|
||||
memset(ht->buckets, 0, nb);
|
||||
#ifdef HASHMETER
|
||||
ht->nshrinks++;
|
||||
#endif
|
||||
ht->shift++;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
for (he = oldbuckets[i]; he; he = next) {
|
||||
next = he->next;
|
||||
hep = PL_HashTableRawLookup(ht, he->keyHash, he->key);
|
||||
PR_ASSERT(*hep == 0);
|
||||
he->next = 0;
|
||||
*hep = he;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
memset(oldbuckets, 0xDB, n * sizeof oldbuckets[0]);
|
||||
#endif
|
||||
(*ht->allocOps->freeTable)(ht->allocPriv, oldbuckets);
|
||||
}
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRBool)
|
||||
PL_HashTableRemove(PLHashTable *ht, const void *key)
|
||||
{
|
||||
PLHashNumber keyHash;
|
||||
PLHashEntry *he, **hep;
|
||||
|
||||
keyHash = (*ht->keyHash)(key);
|
||||
hep = PL_HashTableRawLookup(ht, keyHash, key);
|
||||
if ((he = *hep) == 0)
|
||||
return PR_FALSE;
|
||||
|
||||
/* Hit; remove element */
|
||||
PL_HashTableRawRemove(ht, hep, he);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void *)
|
||||
PL_HashTableLookup(PLHashTable *ht, const void *key)
|
||||
{
|
||||
PLHashNumber keyHash;
|
||||
PLHashEntry *he, **hep;
|
||||
|
||||
keyHash = (*ht->keyHash)(key);
|
||||
hep = PL_HashTableRawLookup(ht, keyHash, key);
|
||||
if ((he = *hep) != 0) {
|
||||
return he->value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Same as PL_HashTableLookup but doesn't reorder the hash entries.
|
||||
*/
|
||||
PR_IMPLEMENT(void *)
|
||||
PL_HashTableLookupConst(PLHashTable *ht, const void *key)
|
||||
{
|
||||
PLHashNumber keyHash;
|
||||
PLHashEntry *he, **hep;
|
||||
|
||||
keyHash = (*ht->keyHash)(key);
|
||||
hep = PL_HashTableRawLookupConst(ht, keyHash, key);
|
||||
if ((he = *hep) != 0) {
|
||||
return he->value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Iterate over the entries in the hash table calling func for each
|
||||
** entry found. Stop if "f" says to (return value & PR_ENUMERATE_STOP).
|
||||
** Return a count of the number of elements scanned.
|
||||
*/
|
||||
PR_IMPLEMENT(int)
|
||||
PL_HashTableEnumerateEntries(PLHashTable *ht, PLHashEnumerator f, void *arg)
|
||||
{
|
||||
PLHashEntry *he, **hep;
|
||||
PRUint32 i, nbuckets;
|
||||
int rv, n = 0;
|
||||
PLHashEntry *todo = 0;
|
||||
|
||||
nbuckets = NBUCKETS(ht);
|
||||
for (i = 0; i < nbuckets; i++) {
|
||||
hep = &ht->buckets[i];
|
||||
while ((he = *hep) != 0) {
|
||||
rv = (*f)(he, n, arg);
|
||||
n++;
|
||||
if (rv & (HT_ENUMERATE_REMOVE | HT_ENUMERATE_UNHASH)) {
|
||||
*hep = he->next;
|
||||
if (rv & HT_ENUMERATE_REMOVE) {
|
||||
he->next = todo;
|
||||
todo = he;
|
||||
}
|
||||
} else {
|
||||
hep = &he->next;
|
||||
}
|
||||
if (rv & HT_ENUMERATE_STOP) {
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
hep = &todo;
|
||||
while ((he = *hep) != 0) {
|
||||
PL_HashTableRawRemove(ht, hep, he);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
#ifdef HASHMETER
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
PL_HashTableDumpMeter(PLHashTable *ht, PLHashEnumerator dump, FILE *fp)
|
||||
{
|
||||
double mean, variance;
|
||||
PRUint32 nchains, nbuckets;
|
||||
PRUint32 i, n, maxChain, maxChainLen;
|
||||
PLHashEntry *he;
|
||||
|
||||
variance = 0;
|
||||
nchains = 0;
|
||||
maxChainLen = 0;
|
||||
nbuckets = NBUCKETS(ht);
|
||||
for (i = 0; i < nbuckets; i++) {
|
||||
he = ht->buckets[i];
|
||||
if (!he)
|
||||
continue;
|
||||
nchains++;
|
||||
for (n = 0; he; he = he->next)
|
||||
n++;
|
||||
variance += n * n;
|
||||
if (n > maxChainLen) {
|
||||
maxChainLen = n;
|
||||
maxChain = i;
|
||||
}
|
||||
}
|
||||
mean = (double)ht->nentries / nchains;
|
||||
variance = fabs(variance / nchains - mean * mean);
|
||||
|
||||
fprintf(fp, "\nHash table statistics:\n");
|
||||
fprintf(fp, " number of lookups: %u\n", ht->nlookups);
|
||||
fprintf(fp, " number of entries: %u\n", ht->nentries);
|
||||
fprintf(fp, " number of grows: %u\n", ht->ngrows);
|
||||
fprintf(fp, " number of shrinks: %u\n", ht->nshrinks);
|
||||
fprintf(fp, " mean steps per hash: %g\n", (double)ht->nsteps
|
||||
/ ht->nlookups);
|
||||
fprintf(fp, "mean hash chain length: %g\n", mean);
|
||||
fprintf(fp, " standard deviation: %g\n", sqrt(variance));
|
||||
fprintf(fp, " max hash chain length: %u\n", maxChainLen);
|
||||
fprintf(fp, " max hash chain: [%u]\n", maxChain);
|
||||
|
||||
for (he = ht->buckets[maxChain], i = 0; he; he = he->next, i++)
|
||||
if ((*dump)(he, i, fp) != HT_ENUMERATE_NEXT)
|
||||
break;
|
||||
}
|
||||
#endif /* HASHMETER */
|
||||
|
||||
PR_IMPLEMENT(int)
|
||||
PL_HashTableDump(PLHashTable *ht, PLHashEnumerator dump, FILE *fp)
|
||||
{
|
||||
int count;
|
||||
|
||||
count = PL_HashTableEnumerateEntries(ht, dump, fp);
|
||||
#ifdef HASHMETER
|
||||
PL_HashTableDumpMeter(ht, dump, fp);
|
||||
#endif
|
||||
return count;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PLHashNumber)
|
||||
PL_HashString(const void *key)
|
||||
{
|
||||
PLHashNumber h;
|
||||
const PRUint8 *s;
|
||||
|
||||
h = 0;
|
||||
for (s = (const PRUint8*)key; *s; s++)
|
||||
h = (h >> 28) ^ (h << 4) ^ *s;
|
||||
return h;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(int)
|
||||
PL_CompareStrings(const void *v1, const void *v2)
|
||||
{
|
||||
return strcmp((const char*)v1, (const char*)v2) == 0;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(int)
|
||||
PL_CompareValues(const void *v1, const void *v2)
|
||||
{
|
||||
return v1 == v2;
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef plhash_h___
|
||||
#define plhash_h___
|
||||
/*
|
||||
* API to portable hash table code.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "prtypes.h"
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
typedef struct PLHashEntry PLHashEntry;
|
||||
typedef struct PLHashTable PLHashTable;
|
||||
typedef PRUint32 PLHashNumber;
|
||||
#define PL_HASH_BITS 32 /* Number of bits in PLHashNumber */
|
||||
typedef PLHashNumber (PR_CALLBACK *PLHashFunction)(const void *key);
|
||||
typedef PRIntn (PR_CALLBACK *PLHashComparator)(const void *v1, const void *v2);
|
||||
|
||||
#if defined(XP_OS2_VACPP) && defined(VACPP_FLIP) /* for nsSpaceManager.cpp */
|
||||
PR_END_EXTERN_C /* and nsHTMLDocument.cpp */
|
||||
#endif
|
||||
typedef PRIntn (PR_CALLBACK *PLHashEnumerator)(PLHashEntry *he, PRIntn i, void *arg);
|
||||
|
||||
#if defined(XP_OS2_VACPP) && defined(VACPP_FLIP)
|
||||
PR_BEGIN_EXTERN_C
|
||||
#endif
|
||||
|
||||
/* Flag bits in PLHashEnumerator's return value */
|
||||
#define HT_ENUMERATE_NEXT 0 /* continue enumerating entries */
|
||||
#define HT_ENUMERATE_STOP 1 /* stop enumerating entries */
|
||||
#define HT_ENUMERATE_REMOVE 2 /* remove and free the current entry */
|
||||
#define HT_ENUMERATE_UNHASH 4 /* just unhash the current entry */
|
||||
|
||||
typedef struct PLHashAllocOps {
|
||||
void * (PR_CALLBACK *allocTable)(void *pool, PRSize size);
|
||||
void (PR_CALLBACK *freeTable)(void *pool, void *item);
|
||||
PLHashEntry * (PR_CALLBACK *allocEntry)(void *pool, const void *key);
|
||||
void (PR_CALLBACK *freeEntry)(void *pool, PLHashEntry *he, PRUintn flag);
|
||||
} PLHashAllocOps;
|
||||
|
||||
#define HT_FREE_VALUE 0 /* just free the entry's value */
|
||||
#define HT_FREE_ENTRY 1 /* free value and entire entry */
|
||||
|
||||
struct PLHashEntry {
|
||||
PLHashEntry *next; /* hash chain linkage */
|
||||
PLHashNumber keyHash; /* key hash function result */
|
||||
const void *key; /* ptr to opaque key */
|
||||
void *value; /* ptr to opaque value */
|
||||
};
|
||||
|
||||
struct PLHashTable {
|
||||
PLHashEntry **buckets; /* vector of hash buckets */
|
||||
PRUint32 nentries; /* number of entries in table */
|
||||
PRUint32 shift; /* multiplicative hash shift */
|
||||
PLHashFunction keyHash; /* key hash function */
|
||||
PLHashComparator keyCompare; /* key comparison function */
|
||||
PLHashComparator valueCompare; /* value comparison function */
|
||||
const PLHashAllocOps *allocOps; /* allocation operations */
|
||||
void *allocPriv; /* allocation private data */
|
||||
#ifdef HASHMETER
|
||||
PRUint32 nlookups; /* total number of lookups */
|
||||
PRUint32 nsteps; /* number of hash chains traversed */
|
||||
PRUint32 ngrows; /* number of table expansions */
|
||||
PRUint32 nshrinks; /* number of table contractions */
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* Create a new hash table.
|
||||
* If allocOps is null, use default allocator ops built on top of malloc().
|
||||
*/
|
||||
PR_EXTERN(PLHashTable *)
|
||||
PL_NewHashTable(PRUint32 numBuckets, PLHashFunction keyHash,
|
||||
PLHashComparator keyCompare, PLHashComparator valueCompare,
|
||||
const PLHashAllocOps *allocOps, void *allocPriv);
|
||||
|
||||
PR_EXTERN(void)
|
||||
PL_HashTableDestroy(PLHashTable *ht);
|
||||
|
||||
/* Higher level access methods */
|
||||
PR_EXTERN(PLHashEntry *)
|
||||
PL_HashTableAdd(PLHashTable *ht, const void *key, void *value);
|
||||
|
||||
PR_EXTERN(PRBool)
|
||||
PL_HashTableRemove(PLHashTable *ht, const void *key);
|
||||
|
||||
PR_EXTERN(void *)
|
||||
PL_HashTableLookup(PLHashTable *ht, const void *key);
|
||||
|
||||
PR_EXTERN(void *)
|
||||
PL_HashTableLookupConst(PLHashTable *ht, const void *key);
|
||||
|
||||
PR_EXTERN(PRIntn)
|
||||
PL_HashTableEnumerateEntries(PLHashTable *ht, PLHashEnumerator f, void *arg);
|
||||
|
||||
/* General-purpose C string hash function. */
|
||||
PR_EXTERN(PLHashNumber)
|
||||
PL_HashString(const void *key);
|
||||
|
||||
/* Compare strings using strcmp(), return true if equal. */
|
||||
PR_EXTERN(PRIntn)
|
||||
PL_CompareStrings(const void *v1, const void *v2);
|
||||
|
||||
/* Stub function just returns v1 == v2 */
|
||||
PR_EXTERN(PRIntn)
|
||||
PL_CompareValues(const void *v1, const void *v2);
|
||||
|
||||
/* Low level access methods */
|
||||
PR_EXTERN(PLHashEntry **)
|
||||
PL_HashTableRawLookup(PLHashTable *ht, PLHashNumber keyHash, const void *key);
|
||||
|
||||
PR_EXTERN(PLHashEntry **)
|
||||
PL_HashTableRawLookupConst(PLHashTable *ht, PLHashNumber keyHash,
|
||||
const void *key);
|
||||
|
||||
PR_EXTERN(PLHashEntry *)
|
||||
PL_HashTableRawAdd(PLHashTable *ht, PLHashEntry **hep, PLHashNumber keyHash,
|
||||
const void *key, void *value);
|
||||
|
||||
PR_EXTERN(void)
|
||||
PL_HashTableRawRemove(PLHashTable *ht, PLHashEntry **hep, PLHashEntry *he);
|
||||
|
||||
/* This can be trivially implemented using PL_HashTableEnumerateEntries. */
|
||||
PR_EXTERN(PRIntn)
|
||||
PL_HashTableDump(PLHashTable *ht, PLHashEnumerator dump, FILE *fp);
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
#endif /* plhash_h___ */
|
|
@ -0,0 +1,125 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "prinit.h"
|
||||
#include "prvrsion.h"
|
||||
|
||||
/************************************************************************/
|
||||
/**************************IDENTITY AND VERSIONING***********************/
|
||||
/************************************************************************/
|
||||
#include "_pl_bld.h"
|
||||
#if !defined(_BUILD_TIME)
|
||||
#ifdef HAVE_LONG_LONG
|
||||
#define _BUILD_TIME 0
|
||||
#else
|
||||
#define _BUILD_TIME {0, 0}
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(_BUILD_STRING)
|
||||
#define _BUILD_STRING ""
|
||||
#endif
|
||||
#if !defined(_PRODUCTION)
|
||||
#define _PRODUCTION ""
|
||||
#endif
|
||||
#if defined(DEBUG)
|
||||
#define _DEBUG_STRING " (debug)"
|
||||
#else
|
||||
#define _DEBUG_STRING ""
|
||||
#endif
|
||||
|
||||
/*
|
||||
* A trick to expand the PR_VMAJOR macro before concatenation.
|
||||
*/
|
||||
#define CONCAT(x, y) x ## y
|
||||
#define CONCAT2(x, y) CONCAT(x, y)
|
||||
#define VERSION_DESC_NAME CONCAT2(prVersionDescription_libplds, PR_VMAJOR)
|
||||
|
||||
PRVersionDescription VERSION_DESC_NAME =
|
||||
{
|
||||
/* version */ 2, /* this is the only one supported */
|
||||
/* buildTime */ _BUILD_TIME, /* usecs since midnight 1/1/1970 GMT */
|
||||
/* buildTimeString */ _BUILD_STRING, /* ditto, but human readable */
|
||||
/* vMajor */ PR_VMAJOR, /* NSPR's version number */
|
||||
/* vMinor */ PR_VMINOR, /* and minor version */
|
||||
/* vPatch */ PR_VPATCH, /* and patch */
|
||||
/* beta */ PR_BETA, /* beta build boolean */
|
||||
#if defined(DEBUG)
|
||||
/* debug */ PR_TRUE, /* a debug build */
|
||||
#else
|
||||
/* debug */ PR_FALSE, /* an optomized build */
|
||||
#endif
|
||||
/* special */ PR_FALSE, /* they're all special, but ... */
|
||||
/* filename */ _PRODUCTION, /* the produced library name */
|
||||
/* description */ "Portable runtime", /* what we are */
|
||||
/* security */ "N/A", /* not applicable here */
|
||||
/* copywrite */ "Copyright (c) 1998 Netscape Communications Corporation. All Rights Reserved",
|
||||
/* comment */ "http://www.mozilla.org/MPL/",
|
||||
/* specialString */ ""
|
||||
};
|
||||
|
||||
#ifdef XP_UNIX
|
||||
|
||||
/*
|
||||
* Version information for the 'ident' and 'what commands
|
||||
*
|
||||
* NOTE: the first component of the concatenated rcsid string
|
||||
* must not end in a '$' to prevent rcs keyword substitution.
|
||||
*/
|
||||
static char rcsid[] = "$Header: NSPR " PR_VERSION _DEBUG_STRING
|
||||
" " _BUILD_STRING " $";
|
||||
static char sccsid[] = "@(#)NSPR " PR_VERSION _DEBUG_STRING
|
||||
" " _BUILD_STRING;
|
||||
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint()
|
||||
{
|
||||
#ifdef XP_UNIX
|
||||
/*
|
||||
* Add dummy references to rcsid and sccsid to prevent them
|
||||
* from being optimized away as unused variables.
|
||||
*/
|
||||
const char *dummy;
|
||||
|
||||
dummy = rcsid;
|
||||
dummy = sccsid;
|
||||
#endif
|
||||
return &VERSION_DESC_NAME;
|
||||
} /* versionEntryPointType */
|
||||
|
||||
/* plvrsion.c */
|
||||
|
|
@ -0,0 +1 @@
|
|||
Makefile
|
|
@ -0,0 +1,4 @@
|
|||
/.cvsignore/1.2/Sat May 12 01:13:53 2001//
|
||||
/Makefile.in/1.8/Sun Apr 25 15:00:35 2004//
|
||||
/README/3.1/Sat Mar 28 03:36:48 1998//
|
||||
D
|
|
@ -0,0 +1,2 @@
|
|||
A D/include////
|
||||
A D/src////
|
|
@ -0,0 +1 @@
|
|||
mozilla/nsprpub/lib/libc
|
|
@ -0,0 +1 @@
|
|||
:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
|
|
@ -0,0 +1,56 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Netscape Portable Runtime (NSPR).
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
#! gmake
|
||||
|
||||
MOD_DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(MOD_DEPTH)/config/autoconf.mk
|
||||
|
||||
export NSPR20=1
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
DIRS = include src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
export:: $(TARGETS)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue