[x3d-public] Start of Functional Description of JSON Proto Expander

John Carlson yottzumm at gmail.com
Wed May 27 14:18:57 PDT 2020


Here's the start of a Functional Description of the JSON Proto Expander.  I
was not aware of the scope of this, it includes namespaces/scopes as
strings, the proto expander itself, a flattener to remove empty objects,
and an extern prototype load and search routines.  I can totally understand
why this is a big task.

The main interface looks like this:

// Replace ExternProtoDeclare with ProtoDeclare
object = this.externalPrototypeExpander( file, object );
// Run the Proto Expander
object = this.realPrototypeExpander( file, object, false );

// Remove unused objects
this.zapIs( object );

// remove empty objects created by zapIs
object = this.flattener( object );

If someone wants to put this on a group google doc or github, they have my
permission.

    flattenerArray : function ( object, parentArray )
-- Flatten array
    flattenerObject : function ( object, parentArray, arrayLen )
-- Flatten object
    flattener : function ( object, parentArray, arrayLen )
-- main flattener routine
    pushScope : function ( s )
-- push a namespace on the stack
    popScope : function ()
-- pop a namespace off the stack
    saveDef : function ( def )
-- put the def in the namespace
    getDef : function ( def )
-- get the correct def for the namespace we are in
    getField : function ( scope, field )
-- get a field in the namespace
    getScope : function ( def )
-- get current namespace
    scopeLength : function ()
-- get length of namespace stack
    upScope : function ( i )
-- move window up a level in namespace stack (for searching)
    setValueFromInterface : function ( field, object, objectfield )
-- set object "spot" by examining interface
    getObjectField : function ( f, type )
    findFieldByName : function ( fields, objectfield )
    getScriptFieldFieldTypeFieldByNameAttribute : function ( fields,
objectfield )
    getScriptFieldFieldTypeField : function ( fields, field )
    setScriptFields : function ( fields, def )
    setScriptField : function ( scope, field, f, objectfield, type, def )
    setEnv : function ( scope, protoField, newobject, nodeField, type,
newdef )
    getEnv : function ( scope, protoField )
    setConnectField : function ( scope, field, newobject, objectfield,
type, newdef )
-- set spots for connect field
    setConnectFields : function ( object, p, newobject )
-- set spots for connect fields
    setScriptConnectFields : function ( file, object, p, newobject )
-- set spots for connect fields and scripts.
    getInterface : function ( field )
    setInterface : function ( field, fieldname )
    clearScope : function ( field, object )
    extractConnectedDef : function ( scope, field )
    setObjectValues : function ( scope, field, fieldOrNode, value )
-- set object values in "spots"
    setObjectValue : function ( scope, field, obj, fieldOrNode, value )
-- set object value in "spot"
    zap : function ( field, object )
    zapIs : function ( object )
    prototypeExpander : function ( file, object )
-- Proto Expander interface
    readCode : function ( data, fileExt, protoexp, done, p, newobject )
    handleScript : function ( file, object, p, newobject )
    handleProtoDeclare : function ( file, object, p )
    handleProtoInterface : function ( file, object, p )
    handleProtoInstance : function ( file, object, p )
    realPrototypeExpander : function ( file, object, inScript )

-- The rest of these are for the ExternProtoExpander
    searchForProtoDeclare : function ( object, name )
    searchAndReplaceProto : function ( filename, json, protoname, founddef,
obj, objret )
    loadedProto : function ( data, protoname, obj, filename, protoexp,
objret )
    doLoad : function ( data, u, protoexp, done, p, obj )
    processURLs : function ( localArray, path )
    loadURLs : function ( loadpath, urls, loadedCallback, protoexp, done,
externProtoDeclare, obj )
    load : function ( p, file, object, protoexp, done )
    externalPrototypeExpander : function ( file, object )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20200527/bf3a6a3f/attachment-0001.html>


More information about the x3d-public mailing list