Initial commit

This commit is contained in:
Bassem Girgis
2018-12-20 17:34:07 -06:00
parent 7a2d899662
commit 81b4b9e273
34743 changed files with 5940233 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
SRCS =
include $(SRCDIR)../example.mk

View File

@@ -0,0 +1,9 @@
{
"targets": [
{
"target_name": "example",
"sources": [ "example_wrap.cxx" ],
"include_dirs": ["$srcdir"]
}
]
}

View File

@@ -0,0 +1,8 @@
#define ICONST 42
#define FCONST 2.1828
#define CCONST 'x'
#define CCONST2 '\n'
#define SCONST "Hello World"
#define SCONST2 "\"Hello World\""
#define EXTERN extern
#define FOO (ICONST + BAR)

View File

@@ -0,0 +1,24 @@
/* File : example.i */
%module example
/* A few preprocessor macros */
#define ICONST 42
#define FCONST 2.1828
#define CCONST 'x'
#define CCONST2 '\n'
#define SCONST "Hello World"
#define SCONST2 "\"Hello World\""
/* This should work just fine */
#define EXPR ICONST + 3*(FCONST)
/* This shouldn't do anything */
#define EXTERN extern
/* Neither should this (BAR isn't defined) */
#define FOO (ICONST + BAR)
/* The following directives also produce constants */
%constant int iconst = 37;
%constant double fconst = 3.14;

View File

@@ -0,0 +1 @@
module.exports = require("build/Release/example");

View File

@@ -0,0 +1,14 @@
var example = require("example");
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)");
console.log("FOO = " + example.FOO + " (should be undefined)");