RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  j...@rpm5.org
  Module: rpm                              Date:   20-Apr-2009 17:45:43
  Branch: HEAD                             Handle: 2009042015454201

  Added files:
    rpm/js                  .cvsignore Makefile.am rpm-js.h rpmts-js.c
                            rpmts-js.h
  Modified files:
    rpm                     CHANGES Makefile.am configure.ac

  Log:
    - js: stub-in a rpmts class.
    - js: start js module for RPM objects.

  Summary:
    Revision    Changes     Path
    1.2954      +2  -0      rpm/CHANGES
    2.232       +3  -1      rpm/Makefile.am
    2.368       +1  -1      rpm/configure.ac
    1.1         +8  -0      rpm/js/.cvsignore
    1.1         +44 -0      rpm/js/Makefile.am
    1.1         +36 -0      rpm/js/rpm-js.h
    1.1         +133 -0     rpm/js/rpmts-js.c
    1.1         +23 -0      rpm/js/rpmts-js.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2953 -r1.2954 CHANGES
  --- rpm/CHANGES       19 Apr 2009 22:27:41 -0000      1.2953
  +++ rpm/CHANGES       20 Apr 2009 15:45:42 -0000      1.2954
  @@ -1,5 +1,7 @@
   
   5.2a4 -> 5.2b1:
  +    - jbj: js: stub-in a rpmts class.
  +    - jbj: js: start js module for RPM objects.
       - jbj: js: wire up the File class.
       - jbj: js: replace NSPR with rpmio in the File class.
       - jbj: js: stub in the File class before ripping NSPR (SpiderMonkey).
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/Makefile.am
  ============================================================================
  $ cvs diff -u -r2.231 -r2.232 Makefile.am
  --- rpm/Makefile.am   13 Apr 2009 18:37:28 -0000      2.231
  +++ rpm/Makefile.am   20 Apr 2009 15:45:42 -0000      2.232
  @@ -10,7 +10,8 @@
        lua/[A-Z]* lua/*.[ch] lua/local/l* \
        file/src/[A-Z]* file/src/*.[ch] file/python file/magic file/doc 
file/[A-Z]* file/acinclude.m4 file/aclocal.m4 \
        file/autogen.sh file/config* file/depcomp file/install-sh 
file/ltmain.sh file/missing file/mkinstalldirs \
  -    perl/typemap \
  +     js/Makefile.* js/*.[ch] \
  +     perl/typemap \
        perl/Makefile.PL.in \
        perl/t/00.pod.t perl/t/00.pod.coverage.t \
        perl/rpmxs.c perl/rpmxs.h \
  @@ -65,6 +66,7 @@
        lib \
        build \
        rpmconstant \
  +     @WITH_JS_SUBDIR@ \
        @WITH_PYTHON_SUBDIR@ \
        @WITH_PERL_SUBDIR@ \
        tools \
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/configure.ac
  ============================================================================
  $ cvs diff -u -r2.367 -r2.368 configure.ac
  --- rpm/configure.ac  17 Apr 2009 22:42:11 -0000      2.367
  +++ rpm/configure.ac  20 Apr 2009 15:45:42 -0000      2.368
  @@ -1889,7 +1889,7 @@
       scripts/Makefile scripts/macros.perl scripts/macros.php
       scripts/macros.python tools/Makefile misc/Makefile doc/Makefile
       doc/manual/Makefile doc/fr/Makefile doc/ja/Makefile doc/ko/Makefile
  -    doc/pl/Makefile doc/ru/Makefile doc/sk/Makefile python/Makefile
  +    doc/pl/Makefile doc/ru/Makefile doc/sk/Makefile js/Makefile 
python/Makefile
       scripts/rpm.pc lib/rpmversion.h rpmconstant/Makefile tests/Makefile
       tests/macros
   ])
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/js/.cvsignore
  ============================================================================
  $ cvs diff -u -r0 -r1.1 .cvsignore
  --- /dev/null 2009-04-20 17:45:28 +0200
  +++ .cvsignore        2009-04-20 17:45:43 +0200
  @@ -0,0 +1,8 @@
  +.deps
  +Makefile
  +Makefile.in
  +.libs
  +*.gcda
  +*.gcno
  +*.la
  +*.lo
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/js/Makefile.am
  ============================================================================
  $ cvs diff -u -r0 -r1.1 Makefile.am
  --- /dev/null 2009-04-20 17:45:28 +0200
  +++ Makefile.am       2009-04-20 17:45:43 +0200
  @@ -0,0 +1,44 @@
  +# Makefile for rpm library.
  +
  +AUTOMAKE_OPTIONS = 1.4 foreign
  +
  +LINT = splint
  +
  +EXTRA_DIST =
  +
  +AM_CPPFLAGS = -I. \
  +     -I$(top_srcdir) \
  +     -I$(top_srcdir)/build \
  +     -I$(top_srcdir)/lib \
  +     -I$(top_builddir)/lib \
  +     -I$(top_srcdir)/rpmdb \
  +     -I$(top_srcdir)/rpmio \
  +     -I$(top_srcdir)/misc \
  +     @WITH_DB_CPPFLAGS@ \
  +     @WITH_FILE_CPPFLAGS@ \
  +     @WITH_JS_CPPFLAGS@ \
  +     @WITH_LUA_CPPFLAGS@ \
  +     @WITH_XAR_CPPFLAGS@ \
  +     @WITH_ZLIB_CPPFLAGS@
  +
  +noinst_HEADERS =
  +
  +noinst_LTLIBRARIES = rpmjsm.la
  +
  +rpmjsm_la_CFLAGS = -fno-strict-aliasing
  +rpmjsm_la_LDFLAGS = -module -avoid-version
  +rpmjsm_la_LIBADD = \
  +     $(top_builddir)/build/librpmbuild.la \
  +     $(top_builddir)/lib/librpm.la \
  +     $(top_builddir)/rpmdb/librpmdb.la \
  +     $(top_builddir)/rpmio/librpmio.la \
  +     $(top_builddir)/misc/librpmmisc.la \
  +     $(top_builddir)/$(WITH_JS_SUBDIR)/Linux_All_DBG.OBJ/libjs.a
  +     @LTLIBINTL@
  +
  +rpmjsm_la_SOURCES = \
  +     rpmts-js.c
  +
  +.PHONY:      lint
  +lint:
  +     $(LINT) $(DEFS) $(INCLUDES) $(rpmjs_la_sources)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/js/rpm-js.h
  ============================================================================
  $ cvs diff -u -r0 -r1.1 rpm-js.h
  --- /dev/null 2009-04-20 17:45:28 +0200
  +++ rpm-js.h  2009-04-20 17:45:43 +0200
  @@ -0,0 +1,36 @@
  +#ifndef H_RPM_JS
  +#define H_RPM_JS
  +
  +/**
  + * \file js/rpm-js.h
  + */
  +
  +#include <rpmiotypes.h> 
  +#include <rpmio.h>
  +
  +#include <rpmtypes.h>
  +#include <rpmtag.h>
  +
  +#define      XP_UNIX 1
  +#include "jsapi.h"
  +#include "jscntxt.h" /* XXX JSFRAME_CONSTRUCTING */
  +
  +#ifdef       NOTYET
  +#include "jsapi.h"
  +#include "jsatom.h"
  +#include "jscntxt.h"
  +#include "jsdate.h"
  +#include "jsdbgapi.h"
  +#include "jsemit.h"
  +#include "jsfun.h"
  +#include "jslock.h"
  +#include "jsobj.h"
  +#include "jsparse.h"
  +#include "jsscan.h"
  +#include "jsscope.h"
  +#include "jsscript.h"
  +#include "jsstr.h"
  +#include "jsutil.h" /* Added by JSIFY */
  +#endif
  +
  +#endif       /* H_RPM_JS */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/js/rpmts-js.c
  ============================================================================
  $ cvs diff -u -r0 -r1.1 rpmts-js.c
  --- /dev/null 2009-04-20 17:45:28 +0200
  +++ rpmts-js.c        2009-04-20 17:45:43 +0200
  @@ -0,0 +1,133 @@
  +/** \ingroup js_c
  + * \file js/rpmts-js.c
  + */
  +
  +#include "system.h"
  +
  +#include "rpmts-js.h"
  +
  +#include <rpmts.h>
  +
  +#include "debug.h"
  +
  +/*...@unchecked@*/
  +static int _rpmjs_debug = 0;
  +
  +/*...@unchecked@*/
  +extern int _rpmts_debug;
  +
  +/* --- Object methods */
  +static JSFunctionSpec rpmts_funcs[] = {
  +    {0}
  +};
  +
  +/* --- Object properties */
  +enum rpmts_tinyid {
  +    TSID_DEBUG               = -2,
  +};
  +
  +static JSPropertySpec rpmts_props[] = {
  +   {"debug",         TSID_DEBUG,     JSPROP_ENUMERATE },
  +   {0}
  +};
  +
  +static JSBool
  +rpmts_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
  +{
  +    rpmts ts = (rpmts) JS_GetInstancePrivate(cx, obj, &rpmtsClass, NULL);
  +    jsint tiny = JSVAL_TO_INT(id);
  +    JSBool ok = (ts ? JS_FALSE : JS_TRUE);
  +
  +if (_rpmjs_debug)
  +fprintf(stderr, "==> %s(%p,%p,0x%llx,%p) %s = %s\n", __FUNCTION__, cx, obj, 
(unsigned long long)id, vp, JS_GetStringBytes(JS_ValueToString(cx, id)), 
JS_GetStringBytes(JS_ValueToString(cx, *vp)));
  +
  +    /* XXX return JS_TRUE if private == NULL */
  +
  +    switch (tiny) {
  +    case TSID_DEBUG:
  +     *vp = INT_TO_JSVAL(_rpmts_debug);
  +     ok = JS_TRUE;
  +     break;
  +    default:
  +     break;
  +    }
  +    return ok;
  +}
  +
  +static JSBool
  +rpmts_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
  +{
  +    rpmts ts = (rpmts) JS_GetInstancePrivate(cx, obj, &rpmtsClass, NULL);
  +    jsint tiny = JSVAL_TO_INT(id);
  +    JSBool ok = (ts ? JS_FALSE : JS_TRUE);
  +
  +if (_rpmjs_debug)
  +fprintf(stderr, "==> %s(%p,%p,0x%llx,%p) %s = %s\n", __FUNCTION__, cx, obj, 
(unsigned long long)id, vp, JS_GetStringBytes(JS_ValueToString(cx, id)), 
JS_GetStringBytes(JS_ValueToString(cx, *vp)));
  +
  +    /* XXX return JS_TRUE if ... ? */
  +
  +    switch (tiny) {
  +    case TSID_DEBUG:
  +     if (JS_ValueToInt32(cx, *vp, &_rpmts_debug))
  +         ok = JS_TRUE;
  +     break;
  +    default:
  +     break;
  +    }
  +    return ok;
  +}
  +
  +/* --- Object ctors/dtors */
  +static void
  +rpmts_dtor(JSContext *cx, JSObject *obj)
  +{
  +    rpmts ts = (rpmts) JS_GetInstancePrivate(cx, obj, &rpmtsClass, NULL);
  +
  +if (_rpmjs_debug)
  +fprintf(stderr, "==> %s(%p,%p)\n", __FUNCTION__, cx, obj);
  +
  +    (void)rpmtsFree(ts);
  +}
  +
  +static JSBool
  +rpmts_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval 
*rval)
  +{
  +    JSBool ok = JS_FALSE;
  +
  +if (_rpmjs_debug)
  +fprintf(stderr, "==> %s(%p,%p,%p[%u],%p)\n", __FUNCTION__, cx, obj, argv, 
(unsigned)argc, rval);
  +
  +    if (cx->fp->flags & JSFRAME_CONSTRUCTING) {
  +     rpmts ts = rpmtsCreate();
  +
  +     if (ts == NULL || !JS_SetPrivate(cx, obj, ts)) {
  +         (void) rpmtsFree(ts);
  +         goto exit;
  +     }
  +    } else {
  +     if ((obj = JS_NewObject(cx, &rpmtsClass, NULL, NULL)) == NULL)
  +         goto exit;
  +     *rval = OBJECT_TO_JSVAL(obj);
  +    }
  +    ok = JS_TRUE;
  +
  +exit:
  +    return ok;
  +}
  +
  +/* --- Class initialization */
  +JSClass rpmtsClass = {
  +    "Ts", JSCLASS_HAS_PRIVATE | JSCLASS_HAS_CACHED_PROTO(JSProto_Object),
  +    JS_PropertyStub,  JS_PropertyStub,  rpmts_getprop,  rpmts_setprop,
  +    JS_EnumerateStub, JS_ResolveStub,   JS_ConvertStub,    rpmts_dtor
  +};
  +
  +JSObject *
  +rpmjs_InitTsClass(JSContext *cx, JSObject* obj)
  +{
  +    JSObject * tso;
  +    tso = JS_InitClass(cx, obj, NULL, &rpmtsClass, rpmts_ctor, 1,
  +        rpmts_props, rpmts_funcs, NULL, NULL);
  +assert(tso != NULL);
  +    return tso;
  +}
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/js/rpmts-js.h
  ============================================================================
  $ cvs diff -u -r0 -r1.1 rpmts-js.h
  --- /dev/null 2009-04-20 17:45:28 +0200
  +++ rpmts-js.h        2009-04-20 17:45:43 +0200
  @@ -0,0 +1,23 @@
  +#ifndef H_RPMTS_JS
  +#define H_RPMTS_JS
  +
  +/**
  + * \file js/rpmts-js.h
  + */
  +
  +#include "rpm-js.h"
  +
  +extern JSClass rpmtsClass;
  +
  +#ifdef __cplusplus
  +extern "C" {
  +#endif
  +
  +extern JSObject*
  +rpmjs_InitTsClass(JSContext *cx, JSObject* obj);
  +
  +#ifdef __cplusplus      
  +}
  +#endif
  +
  +#endif       /* H_RPMTS_JS */
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to