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:   18-Apr-2009 20:50:30
  Branch: HEAD                             Handle: 2009041818503000

  Modified files:
    rpm                     CHANGES
    rpm/rpmio               rpmjs.c

  Log:
    - js: add a "arguments" array (swiped from SpiderMonkey js shell).

  Summary:
    Revision    Changes     Path
    1.2947      +1  -0      rpm/CHANGES
    1.5         +17 -2      rpm/rpmio/rpmjs.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2946 -r1.2947 CHANGES
  --- rpm/CHANGES       18 Apr 2009 18:27:21 -0000      1.2946
  +++ rpm/CHANGES       18 Apr 2009 18:50:30 -0000      1.2947
  @@ -1,5 +1,6 @@
   
   5.2a4 -> 5.2b1:
  +    - jbj: js: add a "arguments" array (swiped from SpiderMonkey js shell).
       - jbj: js: add a print method (swiped from SpiderMonkey js shell).
       - rse: RPM_VENDOR_OPENPKG: stick with local RPM sanity checking for 
reasonable warning messages
       - jbj: js: simplify the embedding to the JSAPI examples, not the js 
shell.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmjs.c
  ============================================================================
  $ cvs diff -u -r1.4 -r1.5 rpmjs.c
  --- rpm/rpmio/rpmjs.c 18 Apr 2009 18:27:22 -0000      1.4
  +++ rpm/rpmio/rpmjs.c 18 Apr 2009 18:50:30 -0000      1.5
  @@ -156,6 +156,8 @@
       glob = JS_NewObject(cx, &global_class, NULL, NULL);
       xx = JS_InitStandardClasses(cx, glob);
       xx = JS_DefineFunctions(cx, glob, shell_functions);
  +    js->glob = glob;
  +
   #ifdef       NOTYET
       {        JSObject * env =
                JS_DefineObject(cx, glob, "environment", &env_class, NULL, 0);
  @@ -164,8 +166,21 @@
        js->env = env;
       }
   #endif
  -    js->glob = glob;
  -#endif
  +
  +    {        JSObject * args = JS_NewArrayObject(cx, 0, NULL);
  +     int i;
  +
  +assert(args != NULL);
  +     xx = JS_DefineProperty(cx, glob, "arguments", OBJECT_TO_JSVAL(args),
  +             NULL, NULL, 0);
  +     for (i = 0; i < ac; i++) {
  +         JSString *str = JS_NewStringCopyZ(cx, av[i]);
  +assert(str != NULL);
  +         xx = JS_DefineElement(cx, args, i, STRING_TO_JSVAL(str),
  +                              NULL, NULL, JSPROP_ENUMERATE);
  +     }
  +    }
  +#endif       /* WITH_JS */
   
       return rpmjsLink(js);
   }
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to