wiki.webvm.net/ blog

Greetings from a dark Guildford,

We are happy to announce a new WebVM SDK 0.8.3686 release.

This release introduces the following new features.

New features

WVMClassSpec

WVMClassSpec has been extended in order to support an array extension on existing class specifications:

struct _WVMClassSpec {
    const char      *name;
    UInt16           fieldCount;
    WVMFieldSpec   **fields;
    UInt16           methodCount;
    WVMMethodSpec  **methods;
    /* added in 0.6 */
    WVMCallType      type;
    /* added in 0.7 */
    WVMArrayFuncs   *arrFuncs;
};

The WVMArrayFuncs structure looks like:

typedef struct {
    WVMArrayGetLengthPtr  getLength;
    WVMArrayGetElementPtr getElement;
    WVMArraySetElementPtr setElement;
} WVMArrayFuncs;

This allows a class like File to be extended with array functionality. As an example imagine the following JavaScript:

alert(dir.fullPath); // displays the full path of the File directory
if(dir.isDirectory) {
    for(var i = 0; i < dir.length; i++) {
        alert(dir[i].fullPath); // displays each individual file in directory
    }
}

In order to support this feature in File, the module writer simply sets the arrFuncs field of the File class spec to a valid WVMArrayFuncs structure.

When dir.length is accessed, WebVM will call the getLength function pointer of the WVMArrayFuncs structure. WebVM will also call the getElement function for each individual array element access. This lazy array access allows to provide large result sets to JavaScript without the need to allocate the whole result set at the time the array is created.

For a working example see the updated simple example in the SDK, the Simple class has been extended to support this array extension.

createObjectRef

createObjectRef has been extended as well in order to support reference object arrays with lower footprint. If you imagine the following requirement in the contacts API:

var contacts = pim.contact.getContacts(); // returns Contact[]
for(var i = 0; i < contacts.length; i++) {
    alert(contacts[i].name); // displays the name of the i-th contact
}

To achieve this requirement, we extended createObjectRef with an additional WVMArrayFuncs * pointer:

typedef WVMStatus (*WVCCreateObjectRefPtr) (
        WVM                /* [in]  */ *instance,
        WVMClassSpec       /* [in]  */ *classSpec,
        WVMObject          /* [in]  */  object,
        WVMArrayFuncs      /* [in]  */ *arrFuncs, /* new argument */
        WVMObjectReference /* [out] */ *objectRef);

If you create an object of a given class specification with a arrFuncs argument which is not NULL, WebVM will use the supplied callback functions to access the array elements of your created object (similarly to the WVMClassSpec case).

Please have a look into the simple example into the getFooArray method in order to understand, how this approach can be used.

New XML based policy syntax

WebVM uses a new XML based policy syntax in its powerful security subsystem. The SDK versions will install the example policy set to

\Application Data\Aplix Corporation\WebVM\policy.conf (Windows Mobile 6)

or

%PROGRAMFILES%\Aplix Corporation\WebVM\policy.conf (Windows XP)

As usual, these new features will be documented and described in our tutorial soon.

Runnable

Arguments declared as Runnable for JIDL support one argument now which can be set to any type except VariantType_Variant. If no arguments are passed to a callback, use VariantType_Void instead.

Known issues

  • Arrays of value types are still unsupported

You can re-use your WebVM SDK download URL from your mail Inbox or re-register at sdk.webvm.net.

Posted Fri 19 Dec 2008 17:53:24 GMT

Archives

  • 20081219 released
  • 20081215 released
  • 20081204 released
  • 20081203 released
  • 20081124 released
  • 20081112 released
  • 20081105 released
  • 20081031 released
  • 20081023 released
  • 20081008 released