Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
*.o
cpp/bin/*
cpp/lib/*
cpp/obj/*
js/bin/*
*.TMP
/js/node_modules
/js/bin
/vala/bin
/autogen/node_modules
/autogen/npm-debug.log
*.orig
Expand Down
7 changes: 0 additions & 7 deletions .gitmodules

This file was deleted.

16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
ev3dev language bindings
ev3dev-lang language bindings
========================

This repository provides several language bindings for the sensor, motor, and other functionality in the [ev3dev](http://www.ev3dev.org) Linux distribution for the LEGO MINDSTORMS EV3 hardware.
This repository stores the utilities and metadata information for the ev3dev-lang family of libraries. These libraries are easy-to-use interfaces for the APIs that are available on [ev3dev-based](http://www.ev3dev.org) devices.

We currently have libraries for the following languages here:
- C++
- Node.JS
- Python
We support multiple libraries for various programming languages using a centralized "specification" which we keep updated as kernel changes are made. We don't have the actual library code here (see below) -- instead we use this repo to facilitate the maintenance of our bindings.

Each binding complies with our universal language binding specification, which also serves as high-level documentation for our wrappers.
We currently support libraries for the following languages:
- [C++](https://github.com/ddemidov/ev3dev-lang-cpp)
- [Node.js](https://github.com/wasabifan/ev3dev-lang-js)
- [Python](https://github.com/rhempel/ev3dev-lang-python)

Each binding is written based on our central spec, so each has a uniform interface which is kept close to the ev3dev API surface while still encouraging language-specific enhancements.
8 changes: 4 additions & 4 deletions autogen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ To help us maintain our language bindings, we have written a script to automatic
- If you have not yet done so yet, run `npm install` to install the dependencies for auto-generation

### Running from the command line
If you run the script without any parameters, it will auto-generate all language groups:
If you run the script without any parameters, it will look for an `autogen-config.json` file in your current working directory. The autogen-config file specifies the locations to look for templates and source files.
```
$ node autogen.js
$ node path/to/autogen.js
```

If you would like to only process a single group (as defined in `autogen-list.json`), you can provide the name of the group as a command-line parameter:
If you want to specify a config file manually, you can include use a full file path for the target JSON config file.
```
$ node autogen.js docs
$ node path/to/autogen.js other/path/to/config.json
```

## How it works
Expand Down
35 changes: 0 additions & 35 deletions autogen/autogen-list.json

This file was deleted.

82 changes: 47 additions & 35 deletions autogen/autogen.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,52 +17,64 @@ liquidEngine.registerFilters(config.extraLiquidFilters);

//Load the spec data and list of files to process
var specData = JSON.parse(fs.readFileSync(path.resolve(__dirname, "spec.json")));
var groupsToProcess = getGroupsToProcess();
var targetInfo = getTargetFileInfo();

if (groupsToProcess.length > 0)
console.log("Queuing " + groupsToProcess.length + " file groups...");
else
console.log("Warning: No matching file groups found!");
if(!targetInfo) {
console.error("No valid config file found! Either specify a path to a '" + config.defaultConfigFileName + "' or 'cd' into a directory that has one.");
process.exit(1);
}

var clearTemplatedSections = false;
if (argv.x || argv.clear)
clearTemplatedSections = true;


//Call the process function on each specified file, and log the result
for (var groupIndex = 0; groupIndex < groupsToProcess.length; groupIndex++) {
for (var fileIndex = 0; fileIndex < groupsToProcess[groupIndex].files.length; fileIndex++) {
var filePath = groupsToProcess[groupIndex].files[fileIndex];
var templateDir = path.resolve(__dirname, '..', groupsToProcess[groupIndex].templateDir);;

var autogenContext = {
filePath: filePath,
templateDir: templateDir,
specData: specData,
liquidEngine: liquidEngine,
clearTemplatedSections: clearTemplatedSections
}
for (var fileIndex = 0; fileIndex < targetInfo.files.length; fileIndex++) {
var filePath = targetInfo.files[fileIndex];

core.bootstrapFileProcessor(autogenContext, function (filename, err) {
if (err)
console.log("Error processing file \"" + filename + "\": " + err);
else
console.log("Completed processing file \"" + filename + "\"");
});
var autogenContext = {
filePath: filePath,
templateDir: targetInfo.templateDir,
specData: specData,
liquidEngine: liquidEngine,
clearTemplatedSections: clearTemplatedSections
}
}

function getGroupsToProcess() {
//Load the list of files to process
var groupDefinitions = JSON.parse(fs.readFileSync(path.resolve(__dirname, "autogen-list.json")).toString());

var groupsToProcess = [];
core.bootstrapFileProcessor(autogenContext, function (filename, err) {
if (err)
console.log("Error processing file \"" + filename + "\": " + err);
else
console.log("Completed processing file \"" + filename + "\"");
});
}

//Only queue the files from the group that was specified
for (var groupName in groupDefinitions) {
if (argv._.indexOf(groupName) != -1)
groupsToProcess.push(groupDefinitions[groupName]);
}
function getTargetFileInfo() {
var pathCandidates = argv._.concat(process.cwd());

var configFilePath = pathCandidates.map(function(possiblePath) {
var stat = fs.statSync(possiblePath);

if(stat.isFile())
return path.resolve(possiblePath);
else if (stat.isDirectory())
return path.resolve(possiblePath, config.defaultConfigFileName);
else
return null;

}).filter(function(configPath) {
return !!configPath && fs.existsSync(configPath);
})[0];

if(!configFilePath)
return null;

var loadedTargetFileInfo = JSON.parse(fs.readFileSync(configFilePath).toString());

return groupsToProcess;
return {
templateDir: path.resolve(path.dirname(configFilePath), loadedTargetFileInfo.templateDir),
files: loadedTargetFileInfo.files.map(function(configRelativePath) {
return path.resolve(path.dirname(configFilePath), configRelativePath);
})
};
}
2 changes: 2 additions & 0 deletions autogen/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
var utils = require('./utils.js');

exports.defaultConfigFileName = 'autogen-config.json';

var cStyleAutogenStart = /\/\/\s*~autogen *(.+)/;
var cStyleAutogenEnd = "//~autogen";

Expand Down
7 changes: 0 additions & 7 deletions autogen/templates/autogen-header.liquid

This file was deleted.

55 changes: 0 additions & 55 deletions cpp/Makefile

This file was deleted.

53 changes: 0 additions & 53 deletions cpp/README.md

This file was deleted.

28 changes: 0 additions & 28 deletions cpp/button-test.cpp

This file was deleted.

Loading