-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start on devices, partial tcl support
- Loading branch information
Showing
19 changed files
with
4,882 additions
and
4 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* tcl.js | ||
* | ||
* Atomic OS WASH command | ||
* | ||
* Run a tcl command | ||
* | ||
* @author Scott Elcomb <psema4@gmail.com (http://www.psema4.com) | ||
* @version 2.0.0 | ||
*/ | ||
|
||
window.system = window.system || {}; | ||
system.bin = system.bin || {}; | ||
|
||
/* Dummy constructor | ||
* | ||
* Access programmatically via system.bin.tcl.!!methodName!! | ||
* @constructor | ||
*/ | ||
system.bin.tcl = { | ||
/* @method help | ||
* @returns {string} Returns a simple string synopsis for this command | ||
* | ||
* Simple synopsis on this command, used by the <a href="help.html">help command</a> | ||
*/ | ||
help: function() { | ||
return "Run a tcl command and print the result \n\n Usage: tcl [string]"; | ||
}, | ||
|
||
/* @method exec | ||
* @param {Array} args A list of arguments the command was called with | ||
* Executes command with args. The calling HxProcess is available as **this** and it's first 3 file descriptors are stdin, stdout, and stderr respectively. | ||
* For example, to tcl text to stdout: **this.fd[1].write('foobar');** | ||
*/ | ||
exec: function(args) { | ||
var debug = false; | ||
// 'this' is the calling process | ||
|
||
var stdin = (this.fd && this.fd.length > 0) ? this.fd[0] : false; | ||
var stdout = (this.fd && this.fd.length > 1) ? this.fd[1] : false; | ||
var stderr = (this.fd && this.fd.length > 2) ? this.fd[2] : false; | ||
|
||
try { | ||
var message = (args instanceof Array) ? message = args.join(' ') : args; | ||
var filename = '', result; | ||
|
||
if (message.match(/^< /)) { | ||
filename = message.replace(/^< /, ''); | ||
var buf = system.fs.readFile(filename); | ||
result = tcl(buf); | ||
|
||
} else { | ||
result = tcl(message); | ||
} | ||
|
||
if (result && result.content) stdout.write(result.content); | ||
|
||
} catch(e) { | ||
if (stderr) { | ||
stderr.write('command exception: ' + e); | ||
|
||
} else { | ||
console.log('command exception:'); | ||
console.dir(e); | ||
} | ||
} | ||
|
||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* dev/net.js | ||
* | ||
* ++[black[Atomic OS Class: Network Device]++ | ||
* | ||
* Requires socket.io server | ||
* | ||
* @author Scott Elcomb <psema4@gmail.com (http://www.psema4.com) | ||
* @version 2.0.0 | ||
*/ | ||
|
||
if (! window.io) { | ||
console.warn('socket.io loading failed. faking support for network device') | ||
|
||
window.io = { | ||
connect: function() {} | ||
}; | ||
} | ||
|
||
var HxNETDevice = HxDevice.extend({ | ||
/* @constructor | ||
* @method init | ||
* Extends <a href="../classes/device.html">HxDevice</a> | ||
* | ||
* Represents a basic network device in Atomic OS | ||
* @param {Object} opts Options dictionary | ||
*/ | ||
|
||
init: function(opts) { | ||
this.url = opts.url || ''; | ||
this.buffer = ''; | ||
this._super(opts); | ||
// this.socket = io.connect('http://localhost:3734'); | ||
// this.socket.on('notify', this.write); | ||
}//, | ||
|
||
// send: function(method, data) { | ||
// socket.emit(method, { data: data }); | ||
// } | ||
}); | ||
/* dev/netfs.js | ||
* | ||
* ++[black[Atomic OS Class: Network Filesystem Device]++ | ||
* | ||
* @author Scott Elcomb <psema4@gmail.com (http://www.psema4.com) | ||
* @version 2.0.0 | ||
*/ | ||
|
||
var HxNETFSDevice = HxNETDevice.extend({ | ||
/* @constructor | ||
* @method init | ||
* Extends <a href="net.html">HxNETFSDevice</a> | ||
* | ||
* Represents a network device for access to a hosted filesystem in Atomic OS | ||
* @param {Object} opts Options dictionary | ||
*/ | ||
|
||
init: function(opts) { | ||
this._super(opts); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "- merging device files" | ||
cat "net.js" \ | ||
"netfs.js" \ | ||
> "atomos-dev.js" | ||
|
||
#docs | ||
DOCNGN=`which jsdog` | ||
|
||
if [ -n "$DOCS" ] && [ -n "$DOCNGN" ] | ||
then | ||
echo " - building documentation and unit tests" | ||
|
||
DOCDIR="../docs/device-files" | ||
DOCTMPL="-m ../docs/jsdog.jade" | ||
|
||
$DOCNGN $DOCTMPL -s net.js -t t/net.js > $DOCDIR/net.html | ||
$DOCNGN $DOCTMPL -s netfs.js -t t/netfs.js > $DOCDIR/netfs.html | ||
|
||
else | ||
echo " - skipping documentation and unit tests" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@echo - merging device files | ||
@type net.js netfs.js > atomos-dev.js 2>NUL | ||
@echo - skipping documentation and unit tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* dev/net.js | ||
* | ||
* ++[black[Atomic OS Class: Network Device]++ | ||
* | ||
* Requires socket.io server | ||
* | ||
* @author Scott Elcomb <psema4@gmail.com (http://www.psema4.com) | ||
* @version 2.0.0 | ||
*/ | ||
|
||
if (! window.io) { | ||
console.warn('socket.io loading failed. faking support for network device') | ||
|
||
window.io = { | ||
connect: function() {} | ||
}; | ||
} | ||
|
||
var HxNETDevice = HxDevice.extend({ | ||
/* @constructor | ||
* @method init | ||
* Extends <a href="../classes/device.html">HxDevice</a> | ||
* | ||
* Represents a basic network device in Atomic OS | ||
* @param {Object} opts Options dictionary | ||
*/ | ||
|
||
init: function(opts) { | ||
this.url = opts.url || ''; | ||
this.buffer = ''; | ||
this._super(opts); | ||
// this.socket = io.connect('http://localhost:3734'); | ||
// this.socket.on('notify', this.write); | ||
}//, | ||
|
||
// send: function(method, data) { | ||
// socket.emit(method, { data: data }); | ||
// } | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* dev/netfs.js | ||
* | ||
* ++[black[Atomic OS Class: Network Filesystem Device]++ | ||
* | ||
* @author Scott Elcomb <psema4@gmail.com (http://www.psema4.com) | ||
* @version 2.0.0 | ||
*/ | ||
|
||
var HxNETFSDevice = HxNETDevice.extend({ | ||
/* @constructor | ||
* @method init | ||
* Extends <a href="net.html">HxNETFSDevice</a> | ||
* | ||
* Represents a network device for access to a hosted filesystem in Atomic OS | ||
* @param {Object} opts Options dictionary | ||
*/ | ||
|
||
init: function(opts) { | ||
this._super(opts); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
@echo - creating core system | ||
@type class.js guid.js bus.js stream.js file.js jsfs.js procfs.js domfs.js process.js wash.js panel.js window.js commandWindow.js editWindow.js docWindow.js > atomos-hx.js 2>NUL | ||
@type class.js guid.js bus.js stream.js file.js device.js jsfs.js procfs.js domfs.js process.js wash.js panel.js window.js commandWindow.js editWindow.js docWindow.js > atomos-hx.js 2>NUL | ||
@echo - skipping documentation and unit tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* device.js | ||
* | ||
* ++[black[Atomic OS Class: HxDevice]++ | ||
* | ||
* @author Scott Elcomb <psema4@gmail.com (http://www.psema4.com) | ||
* @version 2.0.0 | ||
*/ | ||
|
||
var HxDevice = HxStream.extend({ | ||
/* @constructor | ||
* @method init | ||
* Extends <a href="stream.html">HxStream</a> | ||
* | ||
* Represents an input and/or output device in an Atomic OS system | ||
* @param {Object} opts Options dictionary | ||
*/ | ||
|
||
init: function(opts) { | ||
this._super(opts); | ||
} | ||
}); |
Oops, something went wrong.