G
GVDC
Example server-side JavaScript Web script, Dictionary class
//Dictionary class, hash array unlimited length configurable speed/efficiency
//
printf("<html><body>");
printf("<b>Creating dictionary</b><br\n>");
var dictobj = new Dictionary(5); //dictionary class
var dvname = "varnam0"; //dict var name
var smplobj = new Object(); //create object
smplobj.xx = "text1"; //add properties
smplobj.yy = "text2";
printf("<b>Storing object into dictionary</b><br\n>");
printf("<br\n>");
//put object into array
dictobj.set(dvname,smplobj);
printf("<b>Reading value stored in dictionary</b><br\n>");
printf("value of " ,dvname, " property xx: [", dictobj.get(dvname).xx, "]<br\n>");
printf("<br\n>");
printf("<b>Changing property xx value to otherval567</b><br\n>");
//values in dictionary are stored by reference, not copy
//modifying value of object's property also changes value stored in dictionary
smplobj.xx = "otherval567";
printf("value of " ,dvname, " property xx after change: [", dictobj.get(dvname).xx, "]<br\n>");
printf("<br\n>");
printf("<b>Checking array (dictionary) length</b><br\n>");
printf("array length: [", dictobj.len(), "]<br\n>");
printf("<br\n>");
printf("<b>Deleting value from array</b><br\n>");
//erase value from dictionary
dictobj.set(dvname,null);
printf("array length after delete: [", dictobj.len(), "]<br\n>");
printf("</body></html>");
--
//Dictionary class, hash array unlimited length configurable speed/efficiency
//
printf("<html><body>");
printf("<b>Creating dictionary</b><br\n>");
var dictobj = new Dictionary(5); //dictionary class
var dvname = "varnam0"; //dict var name
var smplobj = new Object(); //create object
smplobj.xx = "text1"; //add properties
smplobj.yy = "text2";
printf("<b>Storing object into dictionary</b><br\n>");
printf("<br\n>");
//put object into array
dictobj.set(dvname,smplobj);
printf("<b>Reading value stored in dictionary</b><br\n>");
printf("value of " ,dvname, " property xx: [", dictobj.get(dvname).xx, "]<br\n>");
printf("<br\n>");
printf("<b>Changing property xx value to otherval567</b><br\n>");
//values in dictionary are stored by reference, not copy
//modifying value of object's property also changes value stored in dictionary
smplobj.xx = "otherval567";
printf("value of " ,dvname, " property xx after change: [", dictobj.get(dvname).xx, "]<br\n>");
printf("<br\n>");
printf("<b>Checking array (dictionary) length</b><br\n>");
printf("array length: [", dictobj.len(), "]<br\n>");
printf("<br\n>");
printf("<b>Deleting value from array</b><br\n>");
//erase value from dictionary
dictobj.set(dvname,null);
printf("array length after delete: [", dictobj.len(), "]<br\n>");
printf("</body></html>");
--