Remove unnecessary blank lines from Javascript examples
This commit is contained in:
parent
efc5af04e0
commit
aae63efcfe
5 changed files with 44 additions and 44 deletions
|
|
@ -1,14 +1,14 @@
|
|||
var example = require("./example");
|
||||
|
||||
console.log("ICONST = " + example.ICONST + " (should be 42)\n");
|
||||
console.log("FCONST = " + example.FCONST + " (should be 2.1828)\n");
|
||||
console.log("CCONST = " + example.CCONST + " (should be 'x')\n");
|
||||
console.log("CCONST2 = " + example.CCONST2 + " (this should be on a new line)\n");
|
||||
console.log("SCONST = " + example.SCONST + " (should be 'Hello World')\n");
|
||||
console.log("SCONST2 = " + example.SCONST2 + " (should be '\"Hello World\"')\n");
|
||||
console.log("EXPR = " + example.EXPR + " (should be 48.5484)\n");
|
||||
console.log("iconst = " + example.iconst + " (should be 37)\n");
|
||||
console.log("fconst = " + example.fconst + " (should be 3.14)\n");
|
||||
console.log("ICONST = " + example.ICONST + " (should be 42)");
|
||||
console.log("FCONST = " + example.FCONST + " (should be 2.1828)");
|
||||
console.log("CCONST = " + example.CCONST + " (should be 'x')");
|
||||
console.log("CCONST2 = " + example.CCONST2 + " (this should be on a new line)");
|
||||
console.log("SCONST = " + example.SCONST + " (should be 'Hello World')");
|
||||
console.log("SCONST2 = " + example.SCONST2 + " (should be '\"Hello World\"')");
|
||||
console.log("EXPR = " + example.EXPR + " (should be 48.5484)");
|
||||
console.log("iconst = " + example.iconst + " (should be 37)");
|
||||
console.log("fconst = " + example.fconst + " (should be 3.14)");
|
||||
|
||||
console.log("EXTERN = " + example.EXTERN + " (should be undefined)\n");
|
||||
console.log("FOO = " + example.FOO + " (should be undefined)\n");
|
||||
console.log("EXTERN = " + example.EXTERN + " (should be undefined)");
|
||||
console.log("FOO = " + example.FOO + " (should be undefined)");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
var example = require("./example");
|
||||
|
||||
// First create some objects using the pointer library.
|
||||
console.log("Testing the pointer library\n");
|
||||
console.log("Testing the pointer library");
|
||||
a = example.new_intp();
|
||||
b = example.new_intp();
|
||||
c = example.new_intp();
|
||||
|
|
@ -9,9 +9,9 @@ c = example.new_intp();
|
|||
example.intp_assign(a,37);
|
||||
example.intp_assign(b,42);
|
||||
|
||||
console.log(" a = " + example.intp_value(a) + "\n");
|
||||
console.log(" b = " + example.intp_value(b) + "\n");
|
||||
console.log(" c = " + example.intp_value(c) + "\n");
|
||||
console.log(" a = " + example.intp_value(a));
|
||||
console.log(" b = " + example.intp_value(b));
|
||||
console.log(" c = " + example.intp_value(c));
|
||||
|
||||
//// Call the add() function with some pointers
|
||||
example.add(a, b, c);
|
||||
|
|
@ -19,7 +19,7 @@ example.add(a, b, c);
|
|||
//
|
||||
//// Now get the result
|
||||
r = example.intp_value(c);
|
||||
console.log(" 37 + 42 = " + r + "\n");
|
||||
console.log(" 37 + 42 = " + r);
|
||||
|
||||
// Clean up the pointers
|
||||
example.delete_intp(a);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ var example = require("./example");
|
|||
|
||||
// ----- Object creation -----
|
||||
|
||||
console.log("Creating some objects:\n");
|
||||
console.log("Creating some objects:");
|
||||
a = new example.Vector(3,4,5);
|
||||
b = new example.Vector(10,11,12);
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ console.log(" created" + b.print());
|
|||
// This calls the wrapper we placed around operator+(const Vector &a, const Vector &)
|
||||
// It returns a new allocated object.
|
||||
|
||||
console.log("Adding a+b\n");
|
||||
console.log("Adding a+b");
|
||||
c = example.addv(a, b);
|
||||
console.log("a+b = " + c.print());
|
||||
|
||||
|
|
@ -26,9 +26,9 @@ console.log("a+b = " + c.print());
|
|||
// ----- Create a vector array -----
|
||||
|
||||
// Note: Using the high-level interface here
|
||||
console.log("Creating an array of vectors\n");
|
||||
console.log("Creating an array of vectors");
|
||||
va = new example.VectorArray(10);
|
||||
console.log("va = " + va + "\n");
|
||||
console.log("va = " + va);
|
||||
|
||||
// ----- Set some values in the array -----
|
||||
|
||||
|
|
@ -46,20 +46,20 @@ va.set(2,example.addv(a,b));
|
|||
|
||||
// Get some values from the array
|
||||
|
||||
console.log("Getting some array values\n");
|
||||
console.log("Getting some array values");
|
||||
for (i = 0; i < 5; i++) {
|
||||
temp = va.get(i);
|
||||
console.log(i,temp.print());
|
||||
}
|
||||
|
||||
// Watch under resource meter to check on this
|
||||
console.log("Making sure we don't leak memory.\n");
|
||||
console.log("Making sure we don't leak memory.");
|
||||
for (i = 0; i < 1000000; i++) {
|
||||
c = va.get(i % 10);
|
||||
}
|
||||
//---------TODO---------
|
||||
//----- Clean up -----
|
||||
//console.log("Cleaning up\n");
|
||||
//console.log("Cleaning up");
|
||||
|
||||
//example.delete_VectorArray(va);
|
||||
//example.delete_Vector(a);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ void print_vars() {
|
|||
printf("dvar = %g\n", dvar);
|
||||
printf("cvar = %c\n", cvar);
|
||||
printf("strvar = %s\n", strvar ? strvar : "(null)");
|
||||
printf("cstrvar = %s\n", cstrvar ? cstrvar : "(null)");
|
||||
printf("cstrvar = %s\n", cstrvar);
|
||||
printf("iptrvar = %p\n", iptrvar);
|
||||
printf("name = %s\n", name);
|
||||
printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0);
|
||||
|
|
|
|||
|
|
@ -18,27 +18,27 @@ example.ptptr = example.new_Point(37,42);
|
|||
example.name = "Bill";
|
||||
|
||||
// Now console.log out the values of the variables
|
||||
console.log("Variables (values console.loged from Python)" + "\n");
|
||||
console.log("ivar = " + example.ivar + "\n");
|
||||
console.log("svar = " + example.svar + "\n");
|
||||
console.log("lvar = " + example.lvar + "\n");
|
||||
console.log("uivar = " + example.uivar + "\n");
|
||||
console.log("usvar = " + example.usvar + "\n");
|
||||
console.log("ulvar = " + example.ulvar + "\n");
|
||||
console.log("scvar = " + example.scvar + "\n");
|
||||
console.log("ucvar = " + example.ucvar + "\n");
|
||||
console.log("fvar = " + example.fvar + "\n");
|
||||
console.log("dvar = " + example.dvar + "\n");
|
||||
console.log("cvar = " + example.cvar + "\n");
|
||||
console.log("strvar = " + example.strvar+ "\n");
|
||||
console.log("cstrvar = " + example.cstrvar+ "\n");
|
||||
console.log("iptrvar = " + example.iptrvar+ "\n");
|
||||
console.log("name = " + example.name + "\n");
|
||||
console.log("ptptr = " + example.ptptr + ": " + example.Point_print(example.ptptr) + "\n");
|
||||
console.log("pt = " + example.pt + ": " + example.Point_print(example.pt) + "\n");
|
||||
console.log("Variables (values printed from Javascript)");
|
||||
console.log("ivar = " + example.ivar);
|
||||
console.log("svar = " + example.svar);
|
||||
console.log("lvar = " + example.lvar);
|
||||
console.log("uivar = " + example.uivar);
|
||||
console.log("usvar = " + example.usvar);
|
||||
console.log("ulvar = " + example.ulvar);
|
||||
console.log("scvar = " + example.scvar);
|
||||
console.log("ucvar = " + example.ucvar);
|
||||
console.log("fvar = " + example.fvar);
|
||||
console.log("dvar = " + example.dvar);
|
||||
console.log("cvar = " + example.cvar);
|
||||
console.log("strvar = " + example.strvar);
|
||||
console.log("cstrvar = " + example.cstrvar);
|
||||
console.log("iptrvar = " + example.iptrvar);
|
||||
console.log("name = " + example.name);
|
||||
console.log("ptptr = " + example.ptptr + ": " + example.Point_print(example.ptptr));
|
||||
console.log("pt = " + example.pt + ": " + example.Point_print(example.pt));
|
||||
|
||||
|
||||
console.log("\nVariables (values console.loged from C)");
|
||||
console.log("\nVariables (values printed from C)");
|
||||
|
||||
example.print_vars();
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ try{
|
|||
console.log("Good.");
|
||||
}
|
||||
|
||||
console.log("\nI'm going to try and update a structure variable.\n");
|
||||
console.log("\nI'm going to try and update a structure variable.");
|
||||
example.pt = example.ptptr;
|
||||
console.log("The new value is: ");
|
||||
example.pt_print();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue